Line Through Two Points (3D) Notes

Published on: September 29, 2026

These Line Through Two Points (3D) Notes explain how to write the equation of the line joining two points in space, with the working shown line by line. Subtracting one point from the other gives a direction vector, and either point then serves as a place to start from. A parameter slides along that direction to reach every point on the line. Following the same pattern every time keeps the starting point and the direction distinct.

x y z (x₁, y₁, z₁) (x₂, y₂, z₂)

Enter the coordinates of \(P_{1}\) and \(P_{2}\).

Step-by-step method

  1. Set up the problem.
  2. Write the formula.
  3. Work out the direction vector.
  4. Substitute into the vector equation.
  5. Write the parametric equations.
  6. Write the symmetric equations.

Formula: Vector Equation of a Line

This formula describes every point on the line through two points. Start at the first point and add any multiple t of the direction from the first point to the second.

\(\vec{r} = \vec{r}_{1} + t\left(\vec{r}_{2} - \vec{r}_{1}\right)\)

Useful Tips to Remember

The direction vector is the second point minus the first, and any multiple of it describes the same line. Different starting points or scaled directions give equations that look different but describe the same line. A zero direction component means that coordinate never changes, so it is written on its own in symmetric form. Two identical points do not define a line.

Required knowledge

Where Is the Line Through Two Points Used?

The equation of a line through two points describes a straight path in space, which is the basis of motion, aiming and ray tracing. Flight paths and drone routes between two waypoints are written this way. Ray tracing in computer graphics sends a line from the camera through each pixel to find what it hits. Engineers use these equations for pipes, cables and beams in 3D models, and robots follow them for straight-line moves.

  • Straight flight paths between waypoints
  • Rays from the camera in ray tracing
  • Pipes, cables and beams in 3D models
  • Straight-line moves for robot arms
  • Checking whether a third point lies on the line

Line Through Two Points Practice Problems

Example 1 finds the line through \((1, 2, 3)\) and \((4, 5, 6)\), and Example 2 finds the line through the origin and \((1, 0, 0)\), which runs along the x-axis. Examples 3 and 4 give you two more problems of the same kind to try. Find the direction vector, write the equations and compare.

The worked examples below go through the same pattern from start to finish, so you can compare every step with your own working. Try each problem on paper first, then open the example and check your working one step at a time, so you can see exactly which step went wrong if your answer does not match. Use them to check your answers and to understand why each step works.

See Example 1 Hide Example 1

Problem

\(P_{1} = \left(1,\; 2,\; 3\right),\; P_{2} = \left(4,\; 5,\; 6\right)\)

Approach

Step-by-step method

  1. Set up the problem.
  2. Write the formula.
  3. Work out the direction vector.
  4. Substitute into the vector equation.
  5. Write the parametric equations.
  6. Write the symmetric equations.

Formula

Formula: Vector Equation of a Line

This formula describes every point on the line through two points. Start at the first point and add any multiple t of the direction from the first point to the second.

\(\vec{r} = \vec{r}_{1} + t\left(\vec{r}_{2} - \vec{r}_{1}\right)\)

Step 1

Step 1 - Set up the problem.

In this problem: We are finding the line through \(P_{1} = \left(1,\; 2,\; 3\right)\) and \(P_{2} = \left(4,\; 5,\; 6\right)\).

\(P_{1} = \left(1,\; 2,\; 3\right),\; P_{2} = \left(4,\; 5,\; 6\right)\)
x y z (1, 2, 3) (4, 5, 6)

Step 2

Step 2 - Write the formula.

In this problem: A line needs one point and a direction. The vector from the first point to the second gives the direction, and adding any multiple t of it to the first point reaches every point on the line.

\(\vec{r} = \vec{r}_{1} + t\left(\vec{r}_{2} - \vec{r}_{1}\right)\)

Step 3

Step 3 - Work out the direction vector.

In this problem: Subtracting the position vectors, covered in the Vector Subtraction Calculator, gives \(4 - 1 = 3\), \(5 - 2 = 3\) and \(6 - 3 = 3\).

\(\vec{d} = \left\langle 4,\; 5,\; 6 \right\rangle - \left\langle 1,\; 2,\; 3 \right\rangle = \left\langle 4 - 1,\; 5 - 2,\; 6 - 3 \right\rangle = \left\langle 3,\; 3,\; 3 \right\rangle\)

Step 4

Step 4 - Substitute into the vector equation.

In this problem: Replacing \(\vec{r}_{1}\) with \(\left\langle 1,\; 2,\; 3 \right\rangle\) and the direction with \(\left\langle 3,\; 3,\; 3 \right\rangle\) gives \(\vec{r} = \left\langle 1,\; 2,\; 3 \right\rangle + t\left\langle 3,\; 3,\; 3 \right\rangle\).

\(\vec{r} = \left\langle 1,\; 2,\; 3 \right\rangle + t\left\langle 3,\; 3,\; 3 \right\rangle\)

Step 5

Step 5 - Write the parametric equations.

In this problem: Writing each component on its own gives \(x = 1 + 3t\), \(y = 2 + 3t\) and \(z = 3 + 3t\).

\(\begin{gathered} x = 1 + 3t \\ y = 2 + 3t \\ z = 3 + 3t \end{gathered}\)

Step 6

Step 6 - Write the symmetric equations.

In this problem: Solving each parametric equation for t and setting them equal gives \(\frac{x - 1}{3} = \frac{y - 2}{3} = \frac{z - 3}{3}\).

\(\frac{x - 1}{3} = \frac{y - 2}{3} = \frac{z - 3}{3}\)

Final Answer

\(\begin{gathered} x = 1 + 3t \\ y = 2 + 3t \\ z = 3 + 3t \end{gathered}\)
See Example 2 Hide Example 2

Problem

\(P_{1} = \left(0,\; 0,\; 0\right),\; P_{2} = \left(1,\; 0,\; 0\right)\)

Approach

Step-by-step method

  1. Set up the problem.
  2. Write the formula.
  3. Work out the direction vector.
  4. Substitute into the vector equation.
  5. Write the parametric equations.
  6. Write the symmetric equations.

Formula

Formula: Vector Equation of a Line

This formula describes every point on the line through two points. Start at the first point and add any multiple t of the direction from the first point to the second.

\(\vec{r} = \vec{r}_{1} + t\left(\vec{r}_{2} - \vec{r}_{1}\right)\)

Step 1

Step 1 - Set up the problem.

In this problem: We are finding the line through \(P_{1} = \left(0,\; 0,\; 0\right)\) and \(P_{2} = \left(1,\; 0,\; 0\right)\).

\(P_{1} = \left(0,\; 0,\; 0\right),\; P_{2} = \left(1,\; 0,\; 0\right)\)
x y z (0, 0, 0) (1, 0, 0)

Step 2

Step 2 - Write the formula.

In this problem: A line needs one point and a direction. The vector from the first point to the second gives the direction, and adding any multiple t of it to the first point reaches every point on the line.

\(\vec{r} = \vec{r}_{1} + t\left(\vec{r}_{2} - \vec{r}_{1}\right)\)

Step 3

Step 3 - Work out the direction vector.

In this problem: Subtracting the position vectors, covered in the Vector Subtraction Calculator, gives \(1 - 0 = 1\), \(0 - 0 = 0\) and \(0 - 0 = 0\).

\(\vec{d} = \left\langle 1,\; 0,\; 0 \right\rangle - \left\langle 0,\; 0,\; 0 \right\rangle = \left\langle 1 - 0,\; 0 - 0,\; 0 - 0 \right\rangle = \left\langle 1,\; 0,\; 0 \right\rangle\)

Step 4

Step 4 - Substitute into the vector equation.

In this problem: Replacing \(\vec{r}_{1}\) with \(\left\langle 0,\; 0,\; 0 \right\rangle\) and the direction with \(\left\langle 1,\; 0,\; 0 \right\rangle\) gives \(\vec{r} = \left\langle 0,\; 0,\; 0 \right\rangle + t\left\langle 1,\; 0,\; 0 \right\rangle\).

\(\vec{r} = \left\langle 0,\; 0,\; 0 \right\rangle + t\left\langle 1,\; 0,\; 0 \right\rangle\)

Step 5

Step 5 - Write the parametric equations.

In this problem: Writing each component on its own gives \(x = t\), \(y = 0\) and \(z = 0\).

\(\begin{gathered} x = t \\ y = 0 \\ z = 0 \end{gathered}\)

Step 6

Step 6 - Write the symmetric equations.

In this problem: Only one coordinate changes along the line, so the symmetric form is just the fixed coordinates \(y = 0,\; z = 0\).

\(y = 0,\; z = 0\)

Final Answer

\(\begin{gathered} x = t \\ y = 0 \\ z = 0 \end{gathered}\)
See Example 3 Hide Example 3

Problem

\(P_{1} = \left(2,\; -1,\; 0\right),\; P_{2} = \left(5,\; 3,\; 2\right)\)

Approach

Step-by-step method

  1. Set up the problem.
  2. Write the formula.
  3. Work out the direction vector.
  4. Substitute into the vector equation.
  5. Write the parametric equations.
  6. Write the symmetric equations.

Formula

Formula: Vector Equation of a Line

This formula describes every point on the line through two points. Start at the first point and add any multiple t of the direction from the first point to the second.

\(\vec{r} = \vec{r}_{1} + t\left(\vec{r}_{2} - \vec{r}_{1}\right)\)

Step 1

Step 1 - Set up the problem.

In this problem: We are finding the line through \(P_{1} = \left(2,\; -1,\; 0\right)\) and \(P_{2} = \left(5,\; 3,\; 2\right)\).

\(P_{1} = \left(2,\; -1,\; 0\right),\; P_{2} = \left(5,\; 3,\; 2\right)\)
x y z (2, −1, 0) (5, 3, 2)

Step 2

Step 2 - Write the formula.

In this problem: A line needs one point and a direction. The vector from the first point to the second gives the direction, and adding any multiple t of it to the first point reaches every point on the line.

\(\vec{r} = \vec{r}_{1} + t\left(\vec{r}_{2} - \vec{r}_{1}\right)\)

Step 3

Step 3 - Work out the direction vector.

In this problem: Subtracting the position vectors, covered in the Vector Subtraction Calculator, gives \(5 - 2 = 3\), \(3 - \left(-1\right) = 4\) and \(2 - 0 = 2\).

\(\vec{d} = \left\langle 5,\; 3,\; 2 \right\rangle - \left\langle 2,\; -1,\; 0 \right\rangle = \left\langle 5 - 2,\; 3 - \left(-1\right),\; 2 - 0 \right\rangle = \left\langle 3,\; 4,\; 2 \right\rangle\)

Step 4

Step 4 - Substitute into the vector equation.

In this problem: Replacing \(\vec{r}_{1}\) with \(\left\langle 2,\; -1,\; 0 \right\rangle\) and the direction with \(\left\langle 3,\; 4,\; 2 \right\rangle\) gives \(\vec{r} = \left\langle 2,\; -1,\; 0 \right\rangle + t\left\langle 3,\; 4,\; 2 \right\rangle\).

\(\vec{r} = \left\langle 2,\; -1,\; 0 \right\rangle + t\left\langle 3,\; 4,\; 2 \right\rangle\)

Step 5

Step 5 - Write the parametric equations.

In this problem: Writing each component on its own gives \(x = 2 + 3t\), \(y = -1 + 4t\) and \(z = 2t\).

\(\begin{gathered} x = 2 + 3t \\ y = -1 + 4t \\ z = 2t \end{gathered}\)

Step 6

Step 6 - Write the symmetric equations.

In this problem: Solving each parametric equation for t and setting them equal gives \(\frac{x - 2}{3} = \frac{y + 1}{4} = \frac{z}{2}\).

\(\frac{x - 2}{3} = \frac{y + 1}{4} = \frac{z}{2}\)

Final Answer

\(\begin{gathered} x = 2 + 3t \\ y = -1 + 4t \\ z = 2t \end{gathered}\)
See Example 4 Hide Example 4

Problem

\(P_{1} = \left(-1,\; 4,\; 2\right),\; P_{2} = \left(3,\; 0,\; 6\right)\)

Approach

Step-by-step method

  1. Set up the problem.
  2. Write the formula.
  3. Work out the direction vector.
  4. Substitute into the vector equation.
  5. Write the parametric equations.
  6. Write the symmetric equations.

Formula

Formula: Vector Equation of a Line

This formula describes every point on the line through two points. Start at the first point and add any multiple t of the direction from the first point to the second.

\(\vec{r} = \vec{r}_{1} + t\left(\vec{r}_{2} - \vec{r}_{1}\right)\)

Step 1

Step 1 - Set up the problem.

In this problem: We are finding the line through \(P_{1} = \left(-1,\; 4,\; 2\right)\) and \(P_{2} = \left(3,\; 0,\; 6\right)\).

\(P_{1} = \left(-1,\; 4,\; 2\right),\; P_{2} = \left(3,\; 0,\; 6\right)\)
x y z (−1, 4, 2) (3, 0, 6)

Step 2

Step 2 - Write the formula.

In this problem: A line needs one point and a direction. The vector from the first point to the second gives the direction, and adding any multiple t of it to the first point reaches every point on the line.

\(\vec{r} = \vec{r}_{1} + t\left(\vec{r}_{2} - \vec{r}_{1}\right)\)

Step 3

Step 3 - Work out the direction vector.

In this problem: Subtracting the position vectors, covered in the Vector Subtraction Calculator, gives \(3 - \left(-1\right) = 4\), \(0 - 4 = -4\) and \(6 - 2 = 4\).

\(\vec{d} = \left\langle 3,\; 0,\; 6 \right\rangle - \left\langle -1,\; 4,\; 2 \right\rangle = \left\langle 3 - \left(-1\right),\; 0 - 4,\; 6 - 2 \right\rangle = \left\langle 4,\; -4,\; 4 \right\rangle\)

Step 4

Step 4 - Substitute into the vector equation.

In this problem: Replacing \(\vec{r}_{1}\) with \(\left\langle -1,\; 4,\; 2 \right\rangle\) and the direction with \(\left\langle 4,\; -4,\; 4 \right\rangle\) gives \(\vec{r} = \left\langle -1,\; 4,\; 2 \right\rangle + t\left\langle 4,\; -4,\; 4 \right\rangle\).

\(\vec{r} = \left\langle -1,\; 4,\; 2 \right\rangle + t\left\langle 4,\; -4,\; 4 \right\rangle\)

Step 5

Step 5 - Write the parametric equations.

In this problem: Writing each component on its own gives \(x = -1 + 4t\), \(y = 4 - 4t\) and \(z = 2 + 4t\).

\(\begin{gathered} x = -1 + 4t \\ y = 4 - 4t \\ z = 2 + 4t \end{gathered}\)

Step 6

Step 6 - Write the symmetric equations.

In this problem: Solving each parametric equation for t and setting them equal gives \(\frac{x + 1}{4} = \frac{y - 4}{-4} = \frac{z - 2}{4}\).

\(\frac{x + 1}{4} = \frac{y - 4}{-4} = \frac{z - 2}{4}\)

Final Answer

\(\begin{gathered} x = -1 + 4t \\ y = 4 - 4t \\ z = 2 + 4t \end{gathered}\)

Calculator and Practice Mode