Drexel dragonThe Math ForumDonate to the Math Forum

Ask Dr. Math - Questions and Answers from our Archives
Associated Topics || Dr. Math Home || Search Dr. Math

Equation of a Line in 3-D Space

Date: 03/18/2004 at 00:24:42
From: Jared
Subject: 3-D Graphing Equation (x,y,z)

Given two points in 3-D space, such as A(x1,y1,z1) and B(x2,y2,z2),
what would be the equation of the line that connects those points?

I know that in the 2-D plane the equation of a line in slope-intercept
form is y = mx + b, where m is the slope and b is the y-intercept. 
Is there something similar in 3-D?  I believe the equation may involve
finding the intercepts of all three planes (xy, yz, and xz).

Date: 03/18/2004 at 12:28:34
From: Doctor Peterson
Subject: Re: 3-D Graphing Equation (x,y,z)

Hi, Jared. 

In two dimensions, the equation

  y = mx + b

defines a line; but vertical lines can't be represented that way.  The 
most general form of a line is

  Ax + By = C

Here A and B together define the direction of the line.  If you've 
heard of vectors, the vector (A,B) is perpendicular to the line; 
otherwise you can just say that the line from (0,0) to (A,B) is 
perpendicular to it.  C determines where the line crosses that 
perpendicular line.

The equivalent of the first form in three dimensions is

  z = mx + ny + c

with a sort of slope for both m and n, and an "xy-intercept" c.  (The 
terminology is not standard, because we don't commonly use this form.)
Note that this is NOT a line, but a plane.  The general form for a
plane is

  Ax + By + Cz = D

Here the vector (A,B,C) is perpendicular to the plane.

To define a line, you need to intersect two planes.  Does that make 
sense?  So one way to define a line is with TWO equations.  You might 
use these, just as an example: 

  z = mx + b
  z = ny + c

The first is a plane parallel to the y axis, and the second is a 
plane parallel to the x axis.  Not all lines, of course, can be 
written with this form.

You can see some of the standard forms for a line here:


One of those is the two-point form, which answers your question:

  (x - x1)/(x2 - x1) = (y - y1)/(y2 - y1) = (z - z1)/(z2 - z1)

Note that there are actually two equations here (equating three 
expressions).  This is a special case of the point-direction form

  (x - x1)/a = (y - y1)/b = (z - z1)/c

This equation is best described in terms of vectors.  The vector 
(a,b,c) points in the direction of the line; the equations say that 
the change in each coordinate is proportional to the coordinates of 
this vector.

If you introduce a new variable t (which you can think of as time 
while you travel along the line), and let that be equal to the three 
equal expressions above,

  (x - x1)/a = (y - y1)/b = (z - z1)/c = t

then you can solve for x, y, and z to get the parametric equations of 
the line (expressing x, y, and z in terms of the parameter t):

  x = at + x1
  y = bt + y1
  z = ct + z1

This is probably the most-used form. You can see that it says that 
you can find the coordinates at time t by multiplying a, b, and c 
(the components of velocity) by the time, and adding the coordinates 
of the starting point.

If you have any further questions, feel free to write back.

- Doctor Peterson, The Math Forum
Associated Topics:
College Higher-Dimensional Geometry
High School Higher-Dimensional Geometry

Search the Dr. Math Library:

Find items containing (put spaces between keywords):
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

Math Forum Home || Math Library || Quick Reference || Math Forum Search

Ask Dr. MathTM
© 1994-2013 The Math Forum