Capital Gains calculation on sale of house after spouse has died.

Asking question for mother in law. 

Her and her husband built their primary residence 20 years ago for about 200k. Her husband died 3 years ago. 

House is selling for $525k..of course there are closing and realtor fees. 

I read about the single and married capital gains deductions but wondered how the exception rules would apply here? 

I thought there was some math formula for calculating in this situation.

 

THANKS FOR ANY INFO!!!!!!!!!!😁