Math Problem Statement

with the code using sympy

Solution