Part 1 · Chapter 1

Vector Algebra

Every electric and magnetic field is a vector that lives at every point in space. Before we can describe a single field, we need a precise language of magnitude and direction — unit vectors, components, and the two products that quietly run all of electromagnetics.

Electromagnetic Field Theory Prof. Mithun Mondal Reading time ≈ 45 min
i What you'll learn
  • The difference between a scalar and a vector, and why fields demand vectors.
  • How to write any vector with unit vectors and Cartesian components, and how to find its magnitude.
  • The rules of vector addition, subtraction and scaling.
  • Position and distance vectors — the backbone of every field calculation.
  • The dot product (projection, work, flux) and the cross product (area, torque, the right-hand rule).
  • The scalar and vector triple products and what each one measures.
Section 1-1

Scalars & Vectors

A scalar is a quantity described completely by a single number (with its unit): temperature, mass, electric charge, time, or electric potential. A vector needs both a magnitude and a direction: force, velocity, and — at the heart of this course — the electric field \(\vec{E}\) and the magnetic field \(\vec{H}\).

In electromagnetics a field is a quantity defined at every point of a region. A scalar field, such as the potential \(V(x,y,z)\), assigns a number to each point; a vector field, such as \(\vec{E}(x,y,z)\), assigns an arrow — a magnitude and direction — to each point. Mastering the algebra of a single vector is the prerequisite for handling fields made of infinitely many of them.

We write a vector in boldface or with an arrow, \(\vec{A}\), and its magnitude as \(A = |\vec{A}|\). A vector of magnitude one is a unit vector, written \(\hat{a}\).

🔑
A vector splits into magnitude and direction
\[ \vec{A} = A\,\hat{a}_A, \qquad \hat{a}_A = \frac{\vec{A}}{|\vec{A}|} \]

Any vector is its length \(A\) times a unit vector \(\hat{a}_A\) pointing the way. This single idea — peel off the magnitude, keep the direction — recurs throughout the course.

Section 1-2

Unit Vectors & Components

In the Cartesian system, three mutually perpendicular unit vectors \(\hat{a}_x,\ \hat{a}_y,\ \hat{a}_z\) point along the \(x\), \(y\) and \(z\) axes. They form a right-handed set: curling the fingers of the right hand from \(\hat{a}_x\) to \(\hat{a}_y\) makes the thumb point along \(\hat{a}_z\). Any vector \(\vec{A}\) is the sum of its projections on these three axes:

Component form
\[ \vec{A} = A_x\,\hat{a}_x + A_y\,\hat{a}_y + A_z\,\hat{a}_z \]
x z y A A_x A_z
A vector as the sum of its three Cartesian components

The numbers \(A_x, A_y, A_z\) are the components (or scalar components) of \(\vec{A}\). Because the axes are perpendicular, the magnitude follows from the three-dimensional Pythagoras theorem, and the unit vector divides the whole thing by that length:

Magnitude & direction
\[ |\vec{A}| = \sqrt{A_x^2 + A_y^2 + A_z^2}, \qquad \hat{a}_A = \frac{A_x\,\hat{a}_x + A_y\,\hat{a}_y + A_z\,\hat{a}_z}{\sqrt{A_x^2 + A_y^2 + A_z^2}} \]
Section 1-3

Vector Addition & Subtraction

Vectors add component by component. Geometrically this is the parallelogram (or head-to-tail) rule: place the tail of \(\vec{B}\) at the head of \(\vec{A}\), and the resultant \(\vec{C}\) runs from the start of \(\vec{A}\) to the end of \(\vec{B}\).

Sum and difference
\[ \vec{A} \pm \vec{B} = (A_x \pm B_x)\,\hat{a}_x + (A_y \pm B_y)\,\hat{a}_y + (A_z \pm B_z)\,\hat{a}_z \]
A B C = A + B
Head-to-tail addition: the resultant closes the triangle

Addition is commutative (\(\vec{A}+\vec{B}=\vec{B}+\vec{A}\)) and associative. Multiplying by a scalar \(k\) scales every component, stretching the vector and — if \(k\) is negative — reversing it.

Section 1-4

Position & Distance Vectors

The position vector \(\vec{r}_P\) of a point \(P(x,y,z)\) runs from the origin to \(P\):

Position vector
\[ \vec{r}_P = x\,\hat{a}_x + y\,\hat{a}_y + z\,\hat{a}_z \]

The distance vector (or separation vector) from point \(P\) to point \(Q\) is the difference of their position vectors. It is the single most-used object in field theory: in Coulomb's law and the Biot–Savart law, the field at \(Q\) depends on the distance vector from the source at \(P\).

Distance vector & its length
\[ \vec{r}_{PQ} = \vec{r}_Q - \vec{r}_P, \qquad |\vec{r}_{PQ}| = \sqrt{(x_Q-x_P)^2 + (y_Q-y_P)^2 + (z_Q-z_P)^2} \]
🔑
Direction from one point to another
\[ \hat{a}_{PQ} = \frac{\vec{r}_Q - \vec{r}_P}{|\vec{r}_Q - \vec{r}_P|} \]

Subtract the source position from the field-point position, then normalise. Every "points away from the charge" or "perpendicular to the wire" statement later in the course is this formula in action.

Section 1-5

The Dot Product

The dot (scalar) product multiplies two vectors to give a scalar. Geometrically it measures how much one vector lies along another — a projection:

Definition
\[ \vec{A}\cdot\vec{B} = |\vec{A}|\,|\vec{B}|\cos\theta_{AB} = A_xB_x + A_yB_y + A_zB_z \]
B A A cos θ θ
The dot product picks out the part of A that lies along B

Key consequences: the dot product is commutative; it is zero when the vectors are perpendicular (\(\cos 90^\circ = 0\)); and \(\vec{A}\cdot\vec{A} = |\vec{A}|^2\). For the base vectors, \(\hat{a}_x\cdot\hat{a}_x = 1\) and \(\hat{a}_x\cdot\hat{a}_y = 0\). In electromagnetics the dot product is how we compute work (\(\vec{F}\cdot\vec{L}\)) and flux (\(\vec{D}\cdot\vec{S}\)).

Section 1-6

The Cross Product

The cross (vector) product multiplies two vectors to give a third vector, perpendicular to both, with magnitude equal to the area of the parallelogram they span:

Definition
\[ \vec{A}\times\vec{B} = |\vec{A}|\,|\vec{B}|\sin\theta_{AB}\,\hat{a}_n \]

The unit vector \(\hat{a}_n\) is fixed by the right-hand rule: point the fingers along \(\vec{A}\), curl them toward \(\vec{B}\), and the thumb gives \(\hat{a}_n\). In components the cross product is the determinant:

Determinant form
\[ \vec{A}\times\vec{B} = \begin{vmatrix} \hat{a}_x & \hat{a}_y & \hat{a}_z \\ A_x & A_y & A_z \\ B_x & B_y & B_z \end{vmatrix} \]
A B A × B
The cross product is normal to the plane; its length is the parallelogram's area

The cross product is anti-commutative: \(\vec{A}\times\vec{B} = -\,\vec{B}\times\vec{A}\). It is zero for parallel vectors, and \(\hat{a}_x\times\hat{a}_y = \hat{a}_z\) (cyclically). It powers the magnetic force \(\vec{F} = q\vec{v}\times\vec{B}\), torque, and the curl operator we meet in Chapter 3.

Section 1-7

The Triple Products

Three vectors combine in two useful ways. The scalar triple product returns a number equal to the volume of the parallelepiped they span:

Scalar triple product
\[ \vec{A}\cdot(\vec{B}\times\vec{C}) = \begin{vmatrix} A_x & A_y & A_z \\ B_x & B_y & B_z \\ C_x & C_y & C_z \end{vmatrix} \]

Its value is unchanged by cyclic rotation of the vectors: \(\vec{A}\cdot(\vec{B}\times\vec{C}) = \vec{B}\cdot(\vec{C}\times\vec{A}) = \vec{C}\cdot(\vec{A}\times\vec{B})\). The vector triple product returns a vector and is best remembered by the "bac–cab" rule:

Vector triple product (bac–cab)
\[ \vec{A}\times(\vec{B}\times\vec{C}) = \vec{B}\,(\vec{A}\cdot\vec{C}) - \vec{C}\,(\vec{A}\cdot\vec{B}) \]
Why this matters. These two products are not idle algebra — the scalar triple product underlies volume integrals and the Jacobian of coordinate changes (Chapter 2), and the vector triple product appears whenever a curl is curled, as in deriving the wave equation (Part 5). Learn them now and they pay off all course.
Section 1-8

Worked Examples

1 Magnitude and unit vector

Problem. Given \(\vec{A} = 3\,\hat{a}_x - 4\,\hat{a}_y + \hat{a}_z\), find \(|\vec{A}|\) and the unit vector \(\hat{a}_A\).

Solution. Apply the magnitude formula, then divide:

Working
\[ |\vec{A}| = \sqrt{3^2 + (-4)^2 + 1^2} = \sqrt{26}, \qquad \hat{a}_A = \frac{3\,\hat{a}_x - 4\,\hat{a}_y + \hat{a}_z}{\sqrt{26}} \]
2 Distance vector between points

Problem. Find the distance vector from \(P(1,2,3)\) to \(Q(4,0,5)\) and its length.

Solution. Subtract the position vectors component-wise:

Working
\[ \vec{r}_{PQ} = 3\,\hat{a}_x - 2\,\hat{a}_y + 2\,\hat{a}_z, \qquad |\vec{r}_{PQ}| = \sqrt{9+4+4} = \sqrt{17} \]
3 Angle from the dot product

Problem. Find the angle between \(\vec{A} = \hat{a}_x + \hat{a}_y\) and \(\vec{B} = \hat{a}_y + \hat{a}_z\).

Solution. Use \(\cos\theta = (\vec{A}\cdot\vec{B})/(|\vec{A}||\vec{B}|)\):

Working
\[ \cos\theta = \frac{0+1+0}{\sqrt{2}\,\sqrt{2}} = \tfrac{1}{2} \;\Rightarrow\; \theta = 60^\circ \]
4 Cross product & normal

Problem. For \(\vec{A} = 2\,\hat{a}_x + \hat{a}_y\) and \(\vec{B} = \hat{a}_y + \hat{a}_z\), find \(\vec{A}\times\vec{B}\).

Solution. Expand the determinant:

Working
\[ \vec{A}\times\vec{B} = (1\cdot1 - 0\cdot1)\hat{a}_x - (2\cdot1 - 0\cdot0)\hat{a}_y + (2\cdot1 - 1\cdot0)\hat{a}_z = \hat{a}_x - 2\,\hat{a}_y + 2\,\hat{a}_z \]
5 Are three vectors coplanar?

Problem. Test whether \(\vec{A}=\hat{a}_x\), \(\vec{B}=\hat{a}_y\), \(\vec{C}=\hat{a}_x+\hat{a}_y\) are coplanar.

Solution. Coplanar vectors have zero scalar triple product:

Working
\[ \vec{A}\cdot(\vec{B}\times\vec{C}) = \begin{vmatrix} 1&0&0\\ 0&1&0\\ 1&1&0 \end{vmatrix} = 0 \;\Rightarrow\; \textbf{coplanar} \]
6 Projection (scalar component)

Problem. Find the scalar projection of \(\vec{A} = 4\,\hat{a}_x + 3\,\hat{a}_y\) onto \(\vec{B} = \hat{a}_x\).

Solution. The projection of \(\vec{A}\) on \(\hat{a}_B\) is \(\vec{A}\cdot\hat{a}_B\):

Working
\[ A_B = \vec{A}\cdot\hat{a}_x = 4 \]
Review

Chapter Summary

Scalar vs vector

A scalar has magnitude only; a vector has magnitude and direction. Fields assign one to every point in space.

Components

\(\vec{A} = A_x\hat{a}_x + A_y\hat{a}_y + A_z\hat{a}_z\); magnitude \(\sqrt{A_x^2+A_y^2+A_z^2}\); \(\hat{a}_A = \vec{A}/|\vec{A}|\).

Distance vector

\(\vec{r}_{PQ}=\vec{r}_Q-\vec{r}_P\) — the workhorse of Coulomb's and Biot–Savart's laws.

Dot product

\(\vec{A}\cdot\vec{B}=AB\cos\theta\); a scalar; zero when perpendicular; gives work and flux.

Cross product

\(\vec{A}\times\vec{B}=AB\sin\theta\,\hat{a}_n\); a vector; right-hand rule; gives area, force, torque.

Triple products

Scalar triple = volume (and coplanarity test); vector triple = bac–cab.

Practice

Problems

For each item, decide first which operation it tests — magnitude, projection, normal direction, or volume — then apply the matching rule. Difficulty rises down the list.

  1. Given \(\vec{A} = \hat{a}_x + 2\,\hat{a}_y - 2\,\hat{a}_z\), find \(|\vec{A}|\) and \(\hat{a}_A\).
  2. Find the position vector of \(P(2,-1,4)\) and its distance from the origin.
  3. For \(P(0,1,2)\) and \(Q(3,1,-1)\), write \(\vec{r}_{PQ}\) and the unit vector \(\hat{a}_{PQ}\).
  4. Compute \(\vec{A}\cdot\vec{B}\) and the angle between \(\vec{A}=2\,\hat{a}_x-\hat{a}_y\) and \(\vec{B}=\hat{a}_x+2\,\hat{a}_y\). What does the result tell you?
  5. Find a unit vector perpendicular to both \(\vec{A}=\hat{a}_x+\hat{a}_y\) and \(\vec{B}=\hat{a}_y+\hat{a}_z\).
  6. Find the area of the triangle with vertices \(P(0,0,0)\), \(Q(2,0,0)\), \(R(0,3,0)\) using a cross product.
  7. Resolve \(\vec{A}=3\,\hat{a}_x+4\,\hat{a}_y\) into components parallel and perpendicular to \(\vec{B}=\hat{a}_x\).
  8. Evaluate the scalar triple product of \(\vec{A}=\hat{a}_x\), \(\vec{B}=\hat{a}_x+\hat{a}_y\), \(\vec{C}=\hat{a}_x+\hat{a}_y+\hat{a}_z\) and interpret it as a volume.
  9. Verify the bac–cab identity for \(\vec{A}=\hat{a}_x\), \(\vec{B}=\hat{a}_y\), \(\vec{C}=\hat{a}_z\).
  10. Three forces \(\vec{F}_1=2\,\hat{a}_x\), \(\vec{F}_2=-\hat{a}_x+3\,\hat{a}_y\), \(\vec{F}_3=\hat{a}_y-\hat{a}_z\) act at a point. Find the resultant and its magnitude.
  11. Show that \(\vec{A}=\hat{a}_x+\hat{a}_y+\hat{a}_z\), \(\vec{B}=\hat{a}_x-\hat{a}_y\), \(\vec{C}=\hat{a}_x+\hat{a}_y-2\,\hat{a}_z\) are mutually perpendicular.
  12. Prove that \(|\vec{A}\times\vec{B}|^2 + (\vec{A}\cdot\vec{B})^2 = |\vec{A}|^2|\vec{B}|^2\) and explain it geometrically.
Tip: when a problem mentions an angle or asks whether two vectors are perpendicular, reach for the dot product; when it mentions area, a perpendicular direction, or a torque/force, reach for the cross product; when it mentions a volume or coplanarity, reach for the scalar triple product. Picking the right tool is most of the battle.