Hi, here a "pretty long answer" but don't be afraid ! it's only logic, if you are able to do that, you are able to rules the world, promise ! draw it on a paper and everything will be ok (draw it without axis you don't need it, it's only geometry : ) ) what you need to know : Basic trigonometry, pythagore, determinant, polar coordinate and scalar product
I will explain how it work behind the scene
First you need to search two point of the line
take #x = 2# you have #y = -18/7#
take #x = 1# y you have #y = -9/7#
Ok you have two point #A = (2,-18/7)# and #B(1,-9/7)# those points are on the line
Now you want the vector formed by those points
#vec(AB) = (1-2,-9/7+18/7) = (-1,9/7)#
Let's call the point #(3,7)# #P#
Ok now imagine the line you want which is perpendicular to our one, they intersect in one point, let's call this point #H# we don't know what is #H# and we want to know.
we know two things :
#vec(AP) = vec(AH) + vec(HP)#
and # vec(HP) _|_ vec(AB) #
add the determinant both side
#det(vec(AP),vec(AB)) = det(vec(AH),vec(AB)) + det(vec(HP),vec(AB))#
Now consider that #det(vec(a),vec(b)) = a*b*sin(theta)#
where #a# and #b# are the norm and #theta# the angle between the two vector
Obviously #det(vec(AH),vec(AB)) = 0# because #vec(AH)# and #vec(AB)# are on the same line ! so #theta = 0# and #sin(0) = 0 #
#det(vec(AP),vec(AB)) = det(vec(HP),vec(AB))#
Now you wanted a line perpendicular to our one so
#det(vec(HP),vec(AB)) = HP*AB*sin(pi/2) = HP*AB#
Finally do some calculation
#det(vec(AP),vec(AB)) = HP*AB#
#det(vec(AP),vec(AB))/(AB)= HP#
#vec(AP) = (3-2,7+18/7) = (1,67/7)#
#vec(AB) = (1-2,-9/7+18/7) = (-1,9/7)#
#det(vec(AP),vec(AB)) = 76/7#
#AB = sqrt((-1)^2+(9/7)^2) = sqrt(130)/7#
#HP = (76/7)/(sqrt(130)/7) = 76/sqrt(130)#
Ok now we use pythagore to have #AH#
#(sqrt(4538)/7)^2 = (76/sqrt(130))^2+AH^2#
#AH = (277 sqrt(2/65))/7#
Use trigonometry to have the angle formed by #vec(AB)# and the axis then have the angle formed by #vec(AH)# and the axis
You find #cos(theta) = -7/sqrt(130)#
You find #sin(theta) = 9/sqrt(130)#
#x = rcos(theta)#
#y = rsin(theta)#
Where #r# is the norm so :
#x = -277/65#
#y = 2493/455#
#vec(AH) = (-277/65, 2493/455)#
#H = (-277/65 + 2, 2493/455 - 18/7)#
#H = (-147/65, 189/65)#
Now you have this point you can say "AAAAAAAAAAAAAH" because you finished soon
Just need to imagine one more point #M = (x,y)# which can be anywhere
#vec(HM)# and #vec(AB)# are perpendicular if and only if #vec(HM)*vec(AB) = 0#
It's only because #vec(a)*vec(b) = a*b*cos(theta)# if they are perpendicular #theta = pi/2# and #cos(theta) = 0#
#vec(HM) = (x+147/65),(y-189/65)#
#vec(HM)*vec(AB) = -(x+147/65)+9/7(y-189/65)#
#-(x+147/65)+9/7(y-189/65)=0# is your line
Point red is #H#
Point black is #P#
Line blue is #vec(AB)#
You can see the two line