The perimeter of a given triangle, whose sides are in the ratio of \(3 : 4 : 5\), is greater by \(\quantity{4}{ft.}\) than that of a given square. The area of the square is greater by \(\quantity{25}{sq.ft.}\) than that of the triangle. Find the lengths of the sides of the square and of the triangle.

Let the triangle have side lengths \(3a\), \(4a\) and \(5a\) for some \(a\).

We know that a triangle with sides \(3, 4\) and \(5\) is right-angled, by Pythagoras’s Theorem. Our triangle is similar to this triangle, so it must be right-angled too.

This means that its area is \(\dfrac{1}{2}(3a)(4a) = 6a^2\), and its perimeter is \(12a\).

Let \(b\) be the side length of the given square, which therefore has area \(b^2\) and perimeter \(4b\).

Using the information the question gives us about perimeters, we have \(12a = 4 + 4b\), or \(3a = 1 + b\).

Using the information the question gives us about areas, we have \(6a^2 + 25 = b^2\).

By writing \(b = 3a - 1\) and substituting this into the second equation, we see that \[\begin{align*} 6a^2 = (3a - 1)^2 - 25 &\implies 3a^2 - 6a - 24 = 0 \\ &\implies a^2 - 2a - 8 = 0 \\ &\implies (a - 4)(a + 2) = 0. \end{align*}\]Since \(a > 0\), it follows that \(a = 4\), and therefore \(b = 3a - 1 = 11\).

That is, the side lengths of the triangle are \(\quantity{12}{ft}\), \(\quantity{16}{ft}\) and \(\quantity{20}{ft}\), and the side length of the square is \(\quantity{11}{ft.}\)

We don’t have to use the fact that the triangle is right-angled (it is easy to imagine a question where it is not).

We could use in this case Heron’s formula. This tells us that the area of a triangle with side lengths \(\alpha\), \(\beta\) and \(\gamma\) is equal to \[
\sqrt{s(s-\alpha)(s-\beta)(s-\gamma)}
\] where \(s\) is the *semiperimeter* of the triangle, i.e. \[
s = \frac{\alpha + \beta + \gamma}{2}.
\] In our case, the semiperimeter is \(\quantity{6a}{ft.}\) and so the area of the triangle is \[
\quantity{\sqrt{6a(6a - 3a)(6a - 4a)(6a - 5a)}}{sq.ft.} = \quantity{6a^2}{sq.ft.}
\]