3D Coordinates and Vectors

Nerd Cafe

1. Understanding 3D Coordinates

In 3D space, each point P(x, y, z) is represented by three values where:

  • x is the position on the X-axis (left-right)

  • y is the position on the Y-axis (front-back)

  • z is the position on the Z-axis (up-down)

Example:

A point A(2, 3, 4) means:

  • 2 units along X-axis

  • 3 units along Y-axis

  • 4 units along Z-axis

2. What is a Vector in 3D?

A vector in 3D space has:

  • Direction

  • Magnitude (length)

A 3D vector is written as:

v=(a,b,c)\overrightarrow{v}=\left( a, b, c \right)

Where a, b, and c are the components along x, y, and z.

3. Vector from Two Points

To find a vector from point A to point B:

AB=(xbxa  ,ybya  ,zbza)\overrightarrow{AB}=\left( x_{b}-x_{a} \; , y_{b}-y_{a} \; , z_{b}-z_{a} \right)

Example:

Let A = (1, 2, 3) and B = (4, 6, 9). Then

AB=(41,62,93)=(3,4,6)\overrightarrow{AB} =\left( 4−1,6−2,9−3 \right)=\left( 3,4,6 \right)

Python Code:

Output:

2. Vector Magnitude (Length)

v=x2+y2+z2\left| \overrightarrow{v} \right|=\sqrt{x^{2}+y^{2}+z^{2}}

Example:

v=(3,4,6)v=32+42+62=61\overrightarrow{v}=(3,4,6)\Rightarrow \left| \overrightarrow{v} \right|=\sqrt{3^{2}+4^{2}+6^{2}}=\sqrt{61}

Python Code:

5. Unit Vector

A unit vector has magnitude 1 and points in the same direction:

v^=vv\hat{v}=\frac{\overrightarrow{v}}{\left| \overrightarrow{v} \right|}

Python Code:

Output:

6. Dot Product of Two Vectors

A.B=xaxb+yayb+zazb\overrightarrow{A}.\overrightarrow{B}=x_{a}x_{b}+y_{a}y_{b}+z_{a}z_{b}

Used to find the angle between vectors:

cosθ=A.BABcos\theta=\frac{\overrightarrow{A}.\overrightarrow{B}}{|\overrightarrow{A}||\overrightarrow{B}|}

Python Code:

Output:

7. Cross Product

A×B=ijkxayazaxbybzb\overrightarrow{A}\times \overrightarrow{B}=\begin{vmatrix} i & j & k \\ x_{a} & y_{a} & z_{a} \\ x_{b} & y_{b} & z_{b} \end{vmatrix}

Python Code:

Output:

8. Distance Between Two Points in 3D

D=(x2x1)2+(y2y1)2+(z2z1)2D=\sqrt{(x_{2}-x_{1})^{2}+(y_{2}-y_{1})^{2}+(z_{2}-z_{1})^{2}}

Python Code:

Output:

9. Visualizing 3D Vectors

Output:

Keywords

3D coordinates, vectors, vector magnitude, unit vector, dot product, cross product, vector projection, distance in 3D, 3D space, vector operations, python vectors, numpy vectors, angle between vectors, 3D visualization, vector direction, vector length, 3D math, linear algebra, vector geometry, vector representation, nerd cafe

Last updated