### (18) Writing the equation of a line in 3 dimensions

The previous section shows how the equation 3x + 4y = 12 describes a line in 2 dimensions but a plane in 3 dimensions.
So, how would we write the equation of a line in 3 dimensions in terms of x, y and z?
To show you how the working goes, I'll take the particular example of the line
whose vector equation is r = a + tb with a = 2i + 3j - 4k and b = 3i - j + 2k.
Since r is standing for the position vector from O of any point on the line
we'll write r = xi + yj + zk.
The x, y and z will vary as the point P moves on the line.
So now we can say
r = xi + yj + zk = 2i + 3j - 4k + t(3i - j + 2k).
It's particularly easy to see how the next step works, if we write this equation using column vectors. (To do this, we write each set of the i, j and k components in a column.) This gives
Now, this equation can't be satisfied unless it is true for each separate component.
This means that we really have three equations here. We have
x = 2 + 3t
y = 3 - t
z = - 4 + 2t
Rearranging each equation for t gives us
Therefore we can say

This is the equation of the line in terms of x, y and z (also called its cartesian equation).
So, if x = 5 for example, we would have 1 = 3 - y so y = 2 and z + 4 = 2 so z = -2.
The point with coordinates (5,2,-2) lies on this line.
Using the form
we can see that the position vector of this point is given when t = 1.

#### The general case

In general, if a = a1i + a2j + a3k and b = b1i + b2j + b3k then the equation of the line r = a + tb can also be written as
Rearranging as before, we get
which is the cartesian equation of the line.
You can see from this how the components of the position vector a and the direction vector b appear in this equation.
Now we'll find the cartesian equation of the red line which lies in the plane 3x + 4y = 12 from the previous section. This will also show what happens to the working when either a or b or both have components equal to zero.
Here's the picture again, with the line picked out on its own beside it.
I've chosen to work with a = 3j and b = -4i + 3j so r = 3j + t(-4i + 3j).
Taking r = xi + yj + xk as before, and working with column vectors, gives us
From this, we get the three equations
x = - 4t
y = 3 + 3t
z = 0
Rearranging the first two equations gives
So the cartesian equation of this line is given by
So, if x = 8 for example, we have y - 3 = - 6 so y = - 3.
The point (8,-3,0) lies on this line.
Using the vector equation of the line
we can see that we get the position vector of this point when t = -2.

Where next?