The area of the garden can be expressed as:
(16 - x) * (24 - x) = 180, x = width of walk
We can solve this:
384 + x² - 40x = 180
x² - 40x + 204 = 0
(x - 20)² - 400 + 204 = 0
(x - 20)² = 196
x - 20 = ±14
x = 20 ± 14
x = 6 or x = 34.
x cannot be 34 because then the walk would be wider than the garden, which is impossible so x = 6.
To find the dimensions of the garden, take 6 from the dimensions of the garden and the walk so:
16 - 6 = 10
24 - 6 = 18.
This makes sense because 18 * 10 = 180, the area of the garden.
You could also just do trial and error, which happens to be easier in this case but of course, it's not really ideal for all cases.