In this problem, you are supposed to use the Law of Cosines, a generalization of the Pythagorean theorem. Pythagorean gives you the third side of a right triangle; the Law of Cosines does the same for any triangle, if you know the angles. It states
c2 = a2 + b2 -2ab cos θ,
where θ is the angle between sides a and b. Notice that if θ=90°, cos θ=0, and you get back the Pythagorean theorem.
In this problem, the three sides of the triangle are the distances between A and B (=a), B and C (=b), and C and A (=c, unknown). We have a= 54*2.1=113.4 miles and b = 54*1=54 miles. The angle between cities A and C, as measured at B, is θ=180-40-25=115°. Therefore,
c2= 113.42+542-2(113.4)(54)cos(115) = 20951,
c = 145 miles.