I am working with SVG vector graphics, and I want to make a dynamic T shape by adding a perpendicular line. I have a line with two points (4,17) and (11,3). How can I figure out (x1,y1) and (x2,y2)? The distance between (x1,y1) and (x2,y2) is 10, and the midpoint of the new line is (11,3)

The slope between the given points is $$ m = \frac{3 - 17}{11 - 4} = -2 $$ The slope of the perpendicular line is $$ m' = -\frac{1}{m} = \frac 12 $$ Define $$ \Delta x = \cos(\arctan(m')) = \frac{1}{\sqrt{(m')^2 + 1}} = \frac{2}{\sqrt{5}}\\ \Delta y = \sin(\arctan(m')) = \frac{m'}{\sqrt{(m')^2 + 1}} = \frac{1}{\sqrt{5}} $$ The coordinates of the points you want is given by $$ (x_1,y_1) = (11 - 5 \Delta x, 3 - 5 \Delta y)\\ (x_2,y_2) = (11 + 5 \Delta x, 3 + 5 \Delta y) $$