The third marriage lasted 31 years.
If we write the length of the first marriage as a, we can write the whole thing as an equation.
His life pre-marriage is also a, because when his first marriage ended, he'd been married for half of his life. So at the moment we have 2a.
He went 6 years before remarrying, and then it lasted a third of the first one. We can express this as a/3. We now have 2a+a/3+6.
Then, his third marriage was 3 years longer than both of his previous marriages. We can write this as a+a/3+3, so we now have 3a+2a/3+9.
He died at 86, so the equation is
3a+2a/3+9=86
-9
3a+2a/3=77
Rearrange it. Each singular a is 3 full parts, therefore we can write it as 9a/3.
Now we have 11a/3=77.
Divide by 11.
a/3=7
Multiply by 3.
a=21.
The first marriage lasted 21 years. The second lasted 1/3 of that, which is 7. Together, these add up to 28. If you add 3, you are left with 31, meaning the marriage lasted for 31 years.
Hope this helps :)