In any axiomatic geometry course, the proof of this sort of theorem strictly on the sequence of theorems leading up to it. But since we do not know what notes you are following, it is very hard to give an exact answer. However, I can tell you that most often the solution of this problem uses the fact that in a triangle the longest side is opposite the greatest angle. In a right triangle, the right angle is the largest angle. Therefore, any line segment with one endpoint at P and the other on l. which is not the perpendicular is opposite the right angle formed by the perpendicular from P to l.