Hazrat Ali (ra) was well-known for his brilliance in mathematics. In the following stories, he provided immediate yet accurate answers to complex mathematical problems that were brought to him:
Problem # 1:
Two men travelling together sat down to have lunch. One had five loaves of bread, the other three. Another traveler joined them, and they all decided to share the eight loaves by dividing each loaf into three parts. Each man then ate eight pieces.
When the third man got up to leave, he left the two men a total of eight Dirhams to pay for their loaves of bread.
The man who had five loaves gave the one with three loaves three Dirhams and kept five for himself. The man with the three loaves didn’t agree – he wanted a 50% share, i.e., four Dirhams. The man with the five loaves refused and the dispute was brought before Ameer-ul-Mumineen, Ali (ra) bin Abi Talib. Upon hearing their story, Ali (ra) told the man with three loaves that the man with five loaves had already given him more than his fair share and requested him to accept the three Dirhams. The man with the three loaves refused.
Ali (ra) said that in fact the man with the three loaves was entitled to only one dirham out of the eight! He then offered the following explanation: the men had eight loaves of bread divided into three equal parts each, which was equal to twenty-four pieces. Each traveler ate 8 pieces. The man, who had three loaves, had a total of nine pieces from his loaves, out of which he ate eight, leaving only one piece for the third traveler. The man with the five loaves had contributed fifteen pieces, out of which he ate eight, leaving seven pieces for the third man. Hence, the man with the five loaves was entitled to seven Dirhams, whereas the man with the three loaves was entitled to only one Dirham! Subhan’Allah!
Problem # 2:
In another case, a dying man made a will stating that out of his seventeen camels, half were to be given to his eldest son, one-third to his second son and one-ninth to his youngest son. After his death, his relatives could not figure out how to divide the seventeen camels according to the man’s will. So they took their problem to the Caliph Ali (ra) bin Abi Talib, knowing that he would have the answer. Ali (ra) listened to the problem then said, “I will lend one of my camels so that there are eighteen camels and then divide them according to the man’s will. So the eldest son gets half of the eighteen camels, which is nine. The second son gets one-third of the eighteen camels, which is six. The youngest son gets one-ninth of the eighteen camels, which is two.” “That’s seventeen camels,” he said. “And now I will take my camel back!”