I think you should plot the triangles in the Cartesian co-ordinate plane first of all. That will give you a good idea of how to proceed.
Take the first example.
Step (1): Plot the triangle using pencil and paper.
If you plot the triangle through A(-5, 5), B(1, 1), and C(3, 4), you'll find that the legs of the right triangle are the sides BC and BA. The right angle is formed at vertex B.
Find out mid-points of the legs.
The line-segment BC is formed by points B(1,1) and C(3,4). The mid-point, say X, is the point
X ( (1+3)/2, (1+4)/2) i.e. X(2, 5/2).
Similarly the midpoint of the line-segment BA, formed by points B(1,1) and A(-5,5), is
Y ( (1-5)/2, (1+5)/2) i.e. Y(-2, 3)
Now that you know the co-ordinates of the points X and Y, you can easily find the line through them.
Let the line be y = mx + c
It passes through X => 5/2 = 2m + c
It also passes through Y => 3 = -2m + c
Adding the respective sides of these two equations, we have
(5/2) + 3 = 2m + c - 2m + c
=> 11/2 = 2c
=> c = 11/4
Substituting in the 1st equation:
5/2 = 2m + 11/4
=> 2m = 5/2 - 11/4
=> 2m = -1/4
=> m = -1/8
So, the equation of the required line is: y = -x/8 + 11/4
For standard form:
y = -x/8 + 11/4
=> 8y = -x + 22
=> 8y + x - 22 = 0
Problem # 2:
The vertices are the same as Problem # 1, so if you plot the triangle first, you'll find that the hypotenuse is the line-segment AC that passes through the points A(-5,5) and C(3,4).
Let the line passing through A and C have the equation: y = mx + c
It passes through A(-5,5) => 5 = -5m + c .............(1)
It also passes through C(3,4) => 4 = 3m + c ..........(2)
Subtracting the respective sides of equation (2) from equation (1), we have:
1 = -8m => m = -1/8
Substituting this value of m in (1), we have:
5 = -5(-1/8) + c
=> 5 = 5/8 + c
=> c = 35/8
So the equation of the line through the hypotenuse is: y = -x/8 + 35/8.
For standard form:
y = -x/8 + 35/8
=> 8y = -x + 35
=> 8y + x - 35 = 0
First find the slope of each side to determine the right-angle:
Side AB slope (y1-y2)/(x1-x2)=(5-1)/(-5-1)= -4/6 = -2/3
Do same for other sides to determine which two slopes multiplied together equal "-1". These contain the right angle.
Next halve the Y and X distances between ends of each 'leg' of the right triangle i.e. not the hypotenuse side.
When you have these coordinates put into equation (y-y1)/(x-x1)=(y-y2)/(x-x2) and then rearrange to get standard form.
Do same for the coords representing the ends of the hypotenuse