Vector Algebra & Coordinate Systems

The mathematical building blocks for every equation in electromagnetics

ElectromagneticsElectrical Engineering Year 2Free preview
⏱️ About 14 min

Every law in electromagnetics — Gauss's law, Ampere's law, Faraday's law — is written in the language of vectors. Before we can describe a single electric or magnetic field, we need to be fluent in vector algebra and comfortable working in three coordinate systems.

💡
The big idea: Vectors describe quantities that have both magnitude and direction. Three operations — addition, the dot product, and the cross product — together with three coordinate systems, give us the complete geometric toolkit for expressing electromagnetic fields.
🎯 By the end, you'll be able to
  • Perform vector addition, subtraction, and scalar multiplication in component form
  • Compute the dot product using both the geometric and component formulas, and interpret it as a projection
  • Compute the cross product using the determinant formula and determine its direction via the right-hand rule
  • Convert points between Cartesian, cylindrical, and spherical coordinate systems

Why Vectors Matter in Electromagnetics

Electromagnetic fields are inherently vector quantities — they have a magnitude (how strong the field is) and a direction (which way a test charge would be pushed). This means every equation we encounter in this course will involve vectors. Unlike scalar quantities such as temperature or mass, which are fully described by a single number, fields like the electric field E require three components to specify completely.

Fortunately, the vector algebra needed for EM is a small, well-defined toolkit. If you can add vectors, take dot products, take cross products, and switch between coordinate systems, you have the machinery to read and manipulate Maxwell's equations themselves. This lesson refreshes those skills and introduces the three coordinate systems we will use throughout the course.

Vector Notation and Basic Operations

A vector A in three-dimensional space is written in terms of its components along the three Cartesian axes: A = Axx̂ + Ayŷ + Azẑ. Here x̂, ŷ, and ẑ are unit vectors — vectors of length 1 pointing along the x, y, and z axes respectively. The scalars Ax, Ay, Az are the components. The magnitude (or norm) of A is |A| = √(Ax² + Ay² + Az²).

Vector addition and subtraction are performed component by component. If A = 2x̂ + 3ŷ + 1ẑ and B = 1x̂ − 1ŷ + 2ẑ, then A + B = (2+1)x̂ + (3−1)ŷ + (1+2)ẑ = 3x̂ + 2ŷ + 3ẑ. Scalar multiplication scales every component: 2A = 4x̂ + 6ŷ + 2ẑ. These operations are straightforward but appear constantly — whenever we superpose fields from multiple sources, we are just adding vectors.

\[ \mathbf{A} = A_x\,\hat{\mathbf{x}} + A_y\,\hat{\mathbf{y}} + A_z\,\hat{\mathbf{z}}, \qquad |\mathbf{A}| = \sqrt{A_x^2 + A_y^2 + A_z^2} \]
A vector in Cartesian components and its magnitude.
🔑 Unit vectors are the backbone of component notation

Throughout this course, x̂, ŷ, ẑ will always denote the Cartesian unit vectors. In cylindrical coordinates we will use ρ̂, φ̂, ẑ, and in spherical coordinates r̂, θ̂, φ̂. The hat (^) symbol always signals a unit vector.

The Dot Product (Scalar Product)

The dot product (also called the scalar product) takes two vectors and returns a single scalar. The geometric definition is A·B = |A||B|cosθ, where θ is the angle between the two vectors. This tells us the dot product measures how much two vectors point in the same direction — it is zero when they are perpendicular and maximized when they are parallel.

In component form, the dot product is far more practical for computation: A·B = AxBx + AyBy + AzBz. Just multiply corresponding components and sum. The dot product is commutative and distributes over addition. In EM, the dot product appears whenever we compute the component of a field along a direction — for instance, the electric flux through a surface depends on E·, the dot product of the field with the surface normal.

\[ \mathbf{A} \cdot \mathbf{B} = |\mathbf{A}|\,|\mathbf{B}|\cos\theta = A_x B_x + A_y B_y + A_z B_z \]
Two equivalent forms of the dot product: geometric (left) and component (right).
📝 Worked example: Given A = 2x̂ + 3ŷ + 1ẑ and B = 1x̂ − 1ŷ + 2ẑ, compute the dot product A · B.
  1. Identify the components: Ax = 2, Ay = 3, Az = 1 and Bx = 1, By = −1, Bz = 2.
  2. Apply the component formula: A · B = AxBx + AyBy + AzBz.
  3. Substitute: A · B = (2)(1) + (3)(−1) + (1)(2).
  4. Compute each term: A · B = 2 − 3 + 2 = 1.
✓ A · B = 1
✨ What does a dot product of 1 tell us?

The result is a positive scalar, meaning the angle between A and B is acute (less than 90°). The vectors are more aligned than opposed. If the dot product were zero, the vectors would be perpendicular; if negative, they would point in generally opposite directions.

The Cross Product (Vector Product)

The cross product takes two vectors and returns a new vector that is perpendicular to both. Its magnitude is |A×B| = |A||B|sinθ, and the direction is given by the right-hand rule: point your fingers in the direction of A, curl them toward B, and your thumb points in the direction of A×B.

In component form, the cross product is computed as a 3×3 determinant. Expanding along the first row gives: (AyBz − AzBy)x̂ − (AxBz − AzBx)ŷ + (AxBy − AyBx)ẑ. The cross product is not commutative: A×B = −(B×A). In EM, the cross product appears in the Lorentz force law (F = qv×B) and in the definition of the Poynting vector, among many other places.

\[ \mathbf{A} \times \mathbf{B} = \left(A_y B_z - A_z B_y\right)\hat{\mathbf{x}} - \left(A_x B_z - A_z B_x\right)\hat{\mathbf{y}} + \left(A_x B_y - A_y B_x\right)\hat{\mathbf{z}} \]
Component (determinant) formula for the cross product.
⚠️ Mind the sign on the y-component

When expanding the determinant, the middle term (the ŷ component) carries a minus sign. This is the most common arithmetic mistake in cross-product calculations. Always double-check: the pattern is +, −, + for the x̂, ŷ, ẑ terms respectively.

Coordinate Systems for Electromagnetics

Many problems in electromagnetics have natural symmetry, and choosing the right coordinate system can turn an intractable problem into a straightforward one. We will use three systems throughout this course.

Cartesian coordinates (x, y, z) are the default; unit vectors x̂, ŷ, ẑ are constant everywhere. Cylindrical coordinates (ρ, φ, z) are ideal for problems with symmetry about an axis — infinitely long wires, coaxial cables, cylindrical capacitors. Here ρ is the radial distance from the z-axis, φ is the azimuthal angle measured from the x-axis, and z is the same as in Cartesian. Spherical coordinates (r, θ, φ) are used for problems with symmetry about a point — point charges, spheres, dipoles. Here r is the distance from the origin, θ is the polar angle measured from the z-axis, and φ is the same azimuthal angle as in cylindrical.

\[ \rho = \sqrt{x^2 + y^2}, \qquad \phi = \operatorname{atan2}(y,\, x), \qquad z = z \]
Conversion from Cartesian (x, y, z) to cylindrical (ρ, φ, z).

A Concrete Coordinate Conversion

To see how Cartesian-to-cylindrical conversion works in practice, consider the point (x, y, z) = (3, 4, 0). The radial distance is ρ = √(3² + 4²) = √25 = 5. The azimuthal angle is φ = atan2(4, 3) ≈ 53.13°. The z-coordinate carries over unchanged: z = 0. So in cylindrical coordinates, this point is (ρ, φ, z) = (5, 53.13°, 0). Notice that ρ is always non-negative, and atan2 automatically places the angle in the correct quadrant — unlike a simple arctan(y/x), which loses quadrant information.

🔑 Choose coordinates to match symmetry

If a problem involves an infinite line of charge, cylindrical coordinates will simplify the math dramatically. If it involves a point charge, spherical coordinates are the natural choice. If there is no particular symmetry, Cartesian is fine. Matching the coordinate system to the geometry is one of the most important problem-solving skills in EM.

✏️ Practice: Compute the dot product A · B for A = 1x̂ + 2ŷ + 3ẑ and B = 4x̂ − 2ŷ + 1ẑ.
Solution
  1. Identify components: Ax = 1, Ay = 2, Az = 3 and Bx = 4, By = −2, Bz = 1.
  2. Apply the component formula: A · B = (1)(4) + (2)(−2) + (3)(1).
  3. Compute: A · B = 4 − 4 + 3 = 3.

Check your understanding

1. The dot product A · B = 0 implies that the two vectors are:
A · B = |A||B|cosθ = 0 when cosθ = 0, i.e., θ = 90°. The vectors are perpendicular (orthogonal).
2. Which coordinate system is most natural for analyzing the electric field of a point charge at the origin?
A point charge has spherical symmetry — the field depends only on the distance r from the charge. Spherical coordinates align perfectly with this geometry.
✅ Key takeaways
  • Vectors have magnitude and direction, expressed as A = Axx̂ + Ayŷ + Azẑ; addition and scalar multiplication are performed component by component.
  • The dot product A · B = |A||B|cosθ = AxBx + AyBy + AzBz returns a scalar measuring alignment between two vectors; it is zero for perpendicular vectors.
  • The cross product A × B returns a vector perpendicular to both inputs, with magnitude |A||B|sinθ and direction given by the right-hand rule; it is anticommutative.
  • Cartesian (x,y,z), cylindrical (ρ,φ,z), and spherical (r,θ,φ) coordinate systems each match different symmetries; converting from Cartesian to cylindrical uses ρ = √(x²+y²), φ = atan2(y,x), z = z.
➡️ We now have the algebraic tools to manipulate vectors. But electromagnetics deals not just with individual vectors — it deals with vector fields, where a different vector is assigned to every point in space. The next lesson introduces the gradient, divergence, and curl: the three differential operators that form the vocabulary of Maxwell's equations.
Want to test yourself on this? Try the Electrical Aptitude test →