Line Through Two Points (3D) Calculator

Published on: April 19, 2026
Final Answer: Free | Full Steps: Pro

This Line Through Two Points (3D) Calculator writes the equation of the line joining two points in space, and shows the working 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. Find the direction vector, write the equations and compare. For two more free worked examples, check out the Line Through Two Points (3D) Notes.

The worked examples below go through the same pattern from start to finish, so you can compare every step with your own working. For more practice, the notes page goes further with extra worked examples and fuller explanations of the ideas behind each step. Use them together 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}\)

Notes and Practice Mode

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

Example Problems

Click one to load it into the box and solve it.