the fencing line x is the height of a rectangle triangle of base = y, hypothenuse of 9 m, so we use Pythagoras theorem to solve:
hyp^2 = height^2 + base^2
9^2 = x^2 + y^2
x^2 = 81 - y^2
we can see that x is also the height of another rectangle triangle of base = 15 - y, hypothenuse of 12 m, so we use Pythagoras theorem to solve:
hyp^2 = height^2 + base^2
12^2 = x^2 + (15 - y)^2
lets expand:
144 = x^2 + 225 - 30y + y^2
substitute x^2 from the first equation in the last:
144 = 81 - y^2 + 225 - 30y + y^2
144 = 81 + 225 - 30y
30y = -144 + 81 + 225
y = 5.4 m
substitute in the fence equation:
x^2 = 81 - y^2
x^2 = 81 - 5.4^2
x = 7.2 m that is the length of the fence