# The Universe of Discourse

Tue, 03 Jan 2006

Islamic inheritance law
Since Linogram incorporates a generic linear equation solver, it can be used to solve problems that have nothing to do with geometry. I don't claim that the following problem is a "practical application" of Linogram or of the techniques of HOP. But I did find it interesting.

An early and extremely influential book on algebra was Kitab al-jabr wa l-muqabala ("Book of Restoring and Balancing"), written around 850 by Muhammad ibn Musa al-Khwarizmi. In fact, this book was so influential in Europe that it gave us the word "algebra", from the "al-jabr" in the title. The word "algorithm" itself is a corrupted version of "al-Khwarizmi".

One of the types of problems that al-Khwarizmi treats extensively in his book is the problem of computing inheritances under Islamic law. Here's a simple example:

A woman dies, leaving her husband, a son, and three daughters.

Under the law of the time, the husband is entitled to 1/4 of the woman's estate, daughters to equal shares of the remainder, and sons to shares that are twice the daughters'. So a little arithmetic will find that the son receives 30%, and the three daughters 15% each. No algebra is required for this simple problem.

Here's another simple example, one I made up:

A man dies, leaving two sons. His estate consists of ten dirhams of ready cash and ten dirhams as a claim against one of the sons, to whom he has loaned the money.

There is more than one way to look at this, depending on the prevailing law and customs. For example, you might say that the death cancels the debt, and the two sons each get half of the cash, or 5 dirhams. But this is not the solution chosen by al-Khwarismi's society. (Nor by ours.)

Instead, the estate is considered to have 20 dirhams in assets, which are split evenly between the sons. Son #1 gets half, or 10 dirhams, in cash; son #2, who owes the debt, gets 10 dirhams, which cancels his debt and leaves him at zero.

This is the fairest method of allocation because it is the only one that gives the debtor son neither an incentive nor a disincentive to pay back the money. He won't be withholding cash from his dying father in hopes that dad will die and leave him free; nor will he be out borrowing from his friends in a desparate last-minute push to pay back the debt before dad kicks the bucket.

However, here is a more complicated example:

A man dies, leaving two sons and bequeathing one-third of his estate to a stranger. His estate consists of ten dirhams of ready cash and ten dirhams as a claim against one of the sons, to whom he has loaned the money.

According to the Islamic law of the time, if son #2's share of the estate is not large enough to enable him to pay back the debt completely, the remainder is written off as uncollectable. But the stranger gets to collect his legacy before the shares of the rest of the estate is computed.

We need to know son #2's share to calculate the writeoff. But we need to know the writeoff to calculate the value of the estate, we need the value of the estate to calculate the bequest to the stranger, and the need to know the size of the bequest to calculate the size of the shares. So this is a problem in algebra.

In Linogram, we write:

        number estate, writeoff, share, stranger, cash = 10, debt = 10;


Then the laws introduce the following constraints: The total estate is the cash on hand, plus the collectible part of the debt:

        constraints {
estate = cash + (debt - writeoff);


Son #2 pays back part of his debt with his share of the estate; the rest of the debt is written off:

          debt - share = writeoff;


The stranger gets 1/3 of the total estate:

          stranger = estate / 3;


Each son gets a share consisting of half of the value of the estate after the stranger is paid off:

          share = (estate - stranger) / 2;
}


Linogram will solve the equations and try to "draw" the result. We'll tell Linogram that the way to "draw" this "picture" is just to print out the solutions of the equations:

        draw { &dump_all; }
__END__
use Data::Dumper;
sub dump_all {
my $h = shift; print Dumper($h);
}


And now we can get the answer by running Linogram on this file:

        % perl linogram.pl inherit1
$VAR1 = bless( { 'estate' => 15, 'debt' => 10, 'share' => '5', 'writeoff' => 5, 'stranger' => 5, 'cash' => 10 }, 'Environment' );  Here's the solution found by Linogram: Of the 10 dirham debt owed by son #2, 5 dirhams are written off. The estate then consists of 10 dirhams in cash and the 5 dirham debt, totalling 15. The stranger gets one-third, or 5. The two sons each get half of the remainder, or 5 each. That means that the rest of the cash, 5 dirhams, goes to son #1, and son #2's inheritance is to have the other half of his debt cancelled. OK, that was a simple example. Suppose the stranger was only supposed to get 1/4 of the estate instead of 1/3? Then the algebra works out differently: $VAR1 = bless( {
'estate' => 16,
'debt' => 10,
'share' => 6,
'writeoff' => 4,
'stranger' => 4,
'cash' => 10
}, 'Environment' );


Here only 4 dirhams of son #2's debt is forgiven. This leaves an estate of 16 dirhams. 1/4 of the estate, or 4 dirhams, is given to the stranger, leaving 12. Son #1 receives 6 dirhams cash; son #2's 6 dirham debt is cancelled.

(Notice that the rules always cancel the debt; they never leave anyone owing money to either their family or to strangers after the original creditor is dead.)

These examples are both quite simple, and you can solve them in your head with a little tinkering, once you understand the rules. But here is one that al-Khwarizmi treats that I could not do in my head; this is the one that inspired me to pull out Linogram. It is as before, but this time the bequest to the stranger is 1/5 of the estate plus one extra dirham. The Linogram specification is:

        number estate, writeoff, share, stranger, cash = 10, debt = 10;

constraints {
estate = cash + debt - writeoff;
debt = share + writeoff;
stranger = estate / 5 + 1;
share = (estate - stranger)/2;
}

draw { &dump_all; }

__END__

use Data::Dumper;
sub dump_all {
my $h = shift; print Dumper($h);
}


The solution:

        \$VAR1 = bless( {
'estate' => '15.8333333333333',
'debt' => 10,
'share' => '5.83333333333333',
'writeoff' => '4.16666666666667',
'stranger' => '4.16666666666667',
'cash' => 10
}, 'Environment' );


Son #2 has 4 1/6 dirhams of his debt forgiven. He now owes the estate 5 5/6 dirhams. This amount, plus the cash, makes 15 5/6 dirhams. The stranger receives 1/5 of this, or 3 1/6 dirhams, plus 1. This leaves 11 2/3 dirhams to divide equally between the two sons. Son #1 gets the remaining 5 5/6 dirhams cash; son #2's remaining 5 5/6 dirham debt is cancelled.

 Order Episodes in the Mathematics of Medieval Islam with kickback no kickback

(Examples in this message, except the one I made up, were taken from Episodes in the Mathematics of Medieval Islam, by J.L. Berggren (Springer, 1983). Thanks to Walt Mankowski for lending this to me.