Explanation:
the slope of a line is the ratio
y coordinate change / x coordinate change
when going from one point on the line to another.
the perpendicular slope is simply turning that ratio fraction upside down and flips the sign.
(5, 7) to (15, 31)
x changes by +10 (from 5 to 15).
y changes by +24 (from 7 to 31).
the slope (or gradient) is therefore
+24/+10 = 12/5
the perpendicular slope or gradient is then
-5/12