# How to find perpendicular line given a line?

I have two points that form 1 line. I want to find a point that creates a perpendicular line.

Here is an image showing what I am looking for:

How do I find the red point to form a perpendicular line?

• is this 2d or 3d? Sep 28 '19 at 8:24

when a given line with certain equation is give. it has slope of m. so the line that is perpendicular to it has slope of -1/m

you have one point and find out the wanted slope so you can build equation of new line

There is not a specific answer to this question as stated. (Assuming that this is in 3d space, as the coordinates list three values.) Technically, there are infinite perpendicular lines rotated around the black line.

If you have a third point, you can use the Cross Product to get a perpendicular vector, like:

i = B - A;
j = C - A;
p = (i.y * j.z - i.z * j.y, i.z * j.x - i.x * j.y, i.x * j.y - i.y * j.x);
N = A + p;


Where A, B, and C are the points, and i and j are vectors representing their relationship. The vector p will point in the direction perpendicular to the three points and N will be the point relative to the original, as in the picture.

Given that in your question the y coordinate is 0 for both points, it seems you may be interested in an answer in 2d space. In 2d space, there are two possible answers. Given two points A and B:

v = B - A;
p0 = (v.y, -v.x);
p1 = (-v.y, v.x);


For the coordinates you specified, this would work if you ignore the y coordinate and use z in its place.

There is one LINE that solves this problem if this is a 2D question (supported because the known points in the image have '0's for y-coordinates, so your line will be entirely in XZ-plane). However, as a line is a set of infinitely many points, any point that is on the solution line will be a solution point.

You need a line through (-1.75, 0, -2.32), perpendicular to a line through (-1.75, 0, -2.32) and (0,0,0).

Considering only X and Z coordinates, slope of known line is the difference in Z-coordinates divided by difference in X-coordinates: m = (0-(-2.32))/(0-(-1.75)) = 232/175.

The perpendocular slope is

m_perp = -1/m = -175/232.

To get the slope of the line ne in the XZ-plane perpendicular to this one, through (-1.75, 0, -2.32), use the perpendicular slope and the XZ coordinates of that point in the point-slope equation:

Z-Z0 = m_perp(X-X0) Z - (-2.32) = (-175/232)*(X - (-1.75)).

Solve for Z:

Z = -175X/232 - (175^2)/232 + 2.32

(I'm on a phone and don't want to break that down rn)

Now, ANY X coordinate you plug into this will return a valid Z coordinate, giving you a point (X,Z) on the line.

• I followed your answer until you said this Z-Z0 = m_perp(X-X0) Z - (-2.32) = (-175/232)*(X - (-1.75)). Everything after that I can't seem to follow, can you explain it in more detail? What is Z0 and X0? Sep 28 '19 at 18:16