// Lesson 29.2 · Electromagnetics through integrals ②
3D Vectors and Coordinate Systems for Electromagnetics: the Part Textbooks Rush Through
Ask students what confuses them most in electromagnetics and the answer is rarely Maxwell's equations. It is the first few lines of every problem: R=r−r′, R^, aρ, ρdϕ, which most books pass over in a sentence. This page has one job: make those symbols readable and visible, with labs you can turn around in 3D, and finish with a five-step recipe that sets up every field integral in the lessons that follow.
r′ = where the source is (a piece of charge or current) · r = where you want the field · R=r−r′ points from source to field point
∣R∣=Δx2+Δy2+Δz2 · R^=R/∣R∣ · point charge: E=kqR^/R2=kqR/R3
Cylindrical dV=ρdρdϕdz · spherical dV=r2sinθdrdθdϕ · a curved edge is “radius × angle”
aρ,aϕ,ar,aθ change direction from point to point: convert to x, y, z before integrating a vector
Try first: hide every worked solution, then reveal one step at a time
Why electromagnetics needs vectors in three dimensions Basic
In the previous lesson (29.1, in Thai) everything we added up was a scalar. Charges add, resistances in series add. Electric and magnetic fields, however, have a size and a direction. Two pieces of charge can produce fields of the same size pointing different ways, so the total is not the sum of the sizes. That is why every Physics 2 textbook has a vector appendix, and why an engineering electromagnetics course opens with Vector Analysis and Coordinate Systems.
The good news is that the toolkit is small: subtracting vectors, magnitude, unit vectors, dot, cross and three coordinate systems. Notation differs between books, so here is a translation table.
Meaning
Physics 2 (Serway, Halliday)
Hayt & Buck / Sadiku
This page
Radial unit vector
r^
ar or aR
R^ (from the source) · ar (spherical)
Distance from the z axis
r
ρ
ρ here · r in physics problems
Charge per length / area / volume
λ,σ,ρ
ρL,ρS,ρv
λ,σ,ρv
Directed area element
dA
dS
both
Watch the letter ρ: in Hayt, ρ is both the distance from the z axis and the charge density (ρ_v). The subscript tells them apart, so always read it. This page writes ρv for density to avoid the clash.
Source point and field point: r′, r and R = r − r′ Basic
Every field problem has two kinds of point. The source point is where the charge or current sits; its position vector is r′. The field point is where we want to know the field; its position vector is r. Both are measured from the same origin O.
The field does not care where either point is on its own. It cares about the distance and direction from the source to the field point. Follow the arrows: going from O to the charge (r′) and then on to P (R) must land you in the same place as going from O to P directly (r). So r′+R=r, or
V1 Distance vector from the source to the field point
R=r−r′=(x−x′)ax+(y−y′)ay+(z−z′)az
V2 Magnitude and unit vector
R=∣R∣=Δx2+Δy2+Δz2,R^=RR
V3 Point-charge field, vector form
E=R2kqR^=∣r−r′∣3kq(r−r′)
The right-hand form of V3 has R3 underneath, which surprises people: isn't Coulomb's law an inverse square? It still is. The numerator R carries one factor of R; dividing it out leaves R^/R2. The R/R3 form is handier for components because you never compute the unit vector separately.
Example V-1 · line by line, the way EM books do it
A 5 nC charge sits at (1, 2, −1) m. Find E at P(3, −1, 5) m.
Write both positions: r′=(1,2,−1), r=(3,−1,5)
Subtract “end − start”, component by component (V1)
R=(3−1,−1−2,5−(−1))=(2,−3,6)
Magnitude (V2): R=4+9+36=49=7 m · direction R^=71(2,−3,6)
Field size kq/R2=49(8.99×109)(5×10−9)=0.9173 N/C, then multiply by the direction
Subtract the wrong way round and you get r′−r, which points the other way: the field of a positive charge would point into it, which is wrong. Memory aid: R is born at the source and ends at the point you asked about, like light travelling from a lamp to your eye.
3D lab: move the charge and the point P, watch R change
The starting values are Example V-1. The three dashed segments are the components ΔX, ΔY, ΔZ laid end to end from the charge to P, as if you walked along one axis at a time. Drag the picture to rotate it, and use the xy, xz and yz buttons to look straight down each plane and see which component disappears.
Try three things. (1) Move the charge to the origin: now R=r, the only case where the high-school formula applies directly. (2) Make q negative: the E arrow flips but R does not, because R is pure geometry. (3) Put P twice as far away: E drops to a quarter.
Dot and cross: what each one does in a field integral Basic
The whole topic uses just two vector products, and each has a clear job.
V4 Dot product = how much is along
A⋅B=ABcosθ=AxBx+AyBy+AzBz
V5 Cross product = perpendicular, right-hand
∣A×B∣=ABsinθ,ax×ay=az
Use the dot when the question is “how much goes through” or “how much along”. Flux E⋅dA asks how much field pierces a surface (Gauss's law, 29.4, in Thai). Work and voltage E⋅dl ask how much the field helps or opposes a walk along a path (29.5). The result is a scalar, so the pieces simply add.
Use the cross with currents and magnetic fields. The field of a current element Idl×R^ (Biot–Savart, 29.6) and the force on a wire Idl×B (29.10). The result is perpendicular to both factors, so you must picture three dimensions.
Three coordinate systems: Cartesian, cylindrical, spherical Intermediate
The same point in space can be described in several ways, like giving a house address by street number or by GPS. The best coordinates are the ones that make the boundary of the object a constant. A cylinder of radius a is x2+y2=a2 in Cartesian coordinates but simply ρ=a in cylindrical ones, and the limits of the integral become much simpler.
V6 Cylindrical ↔ Cartesian(ρ,ϕ,z): ρ = distance from the z axis, φ measured from +x
x=ρcosϕ,y=ρsinϕ,z=z,ρ=x2+y2
V7 Spherical ↔ Cartesian(r,θ,ϕ): θ measured from +z (0 to π)
x=rsinθcosϕ,y=rsinθsinϕ,z=rcosθ,r=x2+y2+z2
V8 Cylindrical unit vectors in terms of ax,ay (they depend on the φ of the point)
Mind the angle θ: in mathematical and physical spherical coordinates θ is measured down from the z axis (the equator is θ = 90°), not up from the ground like a geographic elevation angle. Get it wrong and sin and cos swap throughout the problem.
Example V-2 · converting both ways
(a) Where is ρ=4,ϕ=120∘,z=3 in Cartesian coordinates? (b) Give (2, 2, 1) in spherical coordinates.
(a) (−2,3.464,3) · (b) (3,70.53∘,45∘) · always use atan2 for φ, because a plain tan−1 cannot tell the first quadrant from the third
The biggest trap: curvilinear unit vectors are not constant
ax points the same way wherever you stand. aρ points “away from the z axis”, which depends on your angle φ: at φ = 0 it points along +x, at φ = 180° along −x. If you add the fields of all the pieces of a ring by writing each as “size × aρ” and then pull aρ out of the integral, the answer is wrong at once.
Example V-3 · why you convert to x, y, z first
Evaluate ∫02πaρdϕ
The common wrong answer: “aρ is a unit vector, take it out” → 2πaρ ✗
0 · arrows pointing outward all round the circle cancel completely. This is the mathematical reason the field of a ring on its axis has no transverse part (lesson 29.3)
See it in the lab: choose cylindrical coordinates and drag the angle φ. The arrows aρ (blue) and aϕ (green) turn with the point P, yet stay perpendicular to each other everywhere, while az never moves.
Length, area and volume elements: where ρ and r² sin θ come from Intermediate
In Cartesian coordinates, changing x by dx moves you a distance dx. In curvilinear coordinates, changing an angle by dφ does not move you a distance dφ, because an angle has no length unit. The real distance is the arc length = radius × angle, which is just the definition of the radian (see the trigonometric functions lesson). Nothing more is involved.
Cylindrical: turning φ by dφ at distance ρ from the axis traces an arc ρdϕ
Spherical: turning θ by dθ on a circle of radius r traces rdθ · turning φ by dφ on a latitude circle, whose radius is only rsinθ, traces rsinθdϕ
V13 Surface elements used most often (direction normal to the surface)
dScylinder wall=ρdϕdzaρ,dSsphere=r2sinθdθdϕar
The lab above has “Show the volume element dV” switched on. It draws the real curved element and compares its true volume with ρdρdϕdz. Shrink Δ and the percentage difference falls toward zero: that is the “limit” step of slice, approximate, sum, limit once again.
Example V-4 · test the formulas on shapes you already know
Use V12 and V13 to find the volume and surface area of a sphere of radius R
Volume: all three limits are constants, so the integral splits into a product
V=∫02πdϕ∫0πsinθdθ∫0Rr2dr=(2π)(2)(3R3)=34πR3
Surface at r = R: S=∫02π∫0πR2sinθdθdϕ=R2(2)(2π)=4πR2
Note ∫0πsinθdθ=2. Forget the sin θ and you get π instead of 2, which is wrong immediately
34πR3 and 4πR2 ✓ · the thin shell 4πr2dr used in lesson 29.1 is V12 with both angles already integrated
Example V-5 · density that depends on angle
A sphere of radius R has ρv=ρ0cos2θ. Find the total charge.
ρ_v depends on θ, so the shell 4πr2dr no longer works; use the full V12
Q=∫02π∫0π∫0Rρ0cos2θr2sinθdrdθdϕ
Split: ∫0Rr2dr=3R3 · ∫02πdϕ=2π · for θ substitute u=cosθ,du=−sinθdθ
∫0πcos2θsinθdθ=∫−11u2du=32
Multiply: Q=ρ0⋅3R3⋅32⋅2π=94πρ0R3
Q=94πρ0R3 · one third of the constant-density case (the average of cos²θ over a sphere is 1/3)
The five-step recipe for any field integral Applied
This is what electromagnetics textbooks do every time, even when they do not number the steps. Follow it and the field of a ring, a disk, a loop or a straight wire all look the same on paper.
Draw and place the axes for maximum symmetry, for example a ring in the xy plane centred at O, with the axis through the point you are asked about
Write r for the field point and r′ for a general piece in Cartesian components; the general piece contains the integration variable (x′, φ′, z′)
Find R = r − r′ and |R| with V1 and V2
Write the source elementdq=λdl′ or Idl′ in the same variable (for a ring dl′=adϕ′)
Write the x, y, z components and integrate. First see which components vanish by symmetry (for example ∫cosϕ′=0); integrate only what is left
Example V-6 · the five steps on a ring of charge
A ring of radius a carries charge Q uniformly and lies in the xy plane. Find E at (0, 0, z).
Steps 1–2: r=(0,0,z) · the piece at angle φ′: r′=(acosϕ′,asinϕ′,0)
Step 3: R=(−acosϕ′,−asinϕ′,z) · R=a2+z2, independent of φ′
E=(a2+z2)3/2kQzaz · the same result physics books get by drawing the cancellation, but with no guessing: ∫cosϕ′=0 does the work
See the pieces and the vector R of this example in 3D below. Choose “Ring of charge”, move the chosen piece, then switch on the field of every piece. The full treatment of each shape is lesson 29.3 (in Thai).
Eight practice problems Basic → Intermediate
Q1A charge at A(1, 0, 2); field point B(4, 4, 2). Find R, R and R^.
R=(3,4,0), R=5
R^=(0.6,0.8,0)
Q2Convert (−3, 3, 4) to cylindrical and spherical coordinates.
ρ=18=4.243, φ in the second quadrant = 135° · r=34=5.831, θ=cos−1(4/5.831)=46.69∘
(4.243,135∘,4) and (5.831,46.69∘,135∘)
Q3Where is ρ=2,ϕ=−60∘,z=0?
2cos(−60∘)=1, 2sin(−60∘)=−3
(1,−1.732,0)
Q4Use dS=ρdρdϕ to find the area of a disk of radius a.
∫02π∫0aρdρdϕ=2π⋅2a2
πa2
Q5Volume of the cone inside a sphere: 0≤r≤R,0≤θ≤60∘
2π⋅3R3⋅[−cosθ]0π/3=32πR3⋅21
πR3/3
Q6A sphere of radius R has ρv=ρ0r2/R2. Total charge?
R24πρ0∫0Rr4dr
54πρ0R3
Q7Find aρ⋅ax and aϕ⋅ax.
From V8
cosϕ and −sinϕ
Q8Arc length of a quarter circle of radius 0.5 m, from V10
∫0π/2ρdϕ=0.5⋅2π
0.785 m
Common mistakes
Wrong
Right
See
R=r′−r
end − start: field point − source
V1
Use kq/R2 but multiply by R, not R^
kqR/R3 or kqR^/R2
V3
Pull aρ or ar out of an integral
Convert to ax,ay,az first
V8, V-3
dV=dρdϕdz or drdθdϕ
Include ρ and r2sinθ
V11, V12
Measure θ up from the ground
θ is measured down from the +z axis
V7
Find φ with tan−1(y/x) without checking the quadrant
Use atan2(y, x)
V-2
Next: the electric field of continuous charge distributions, lesson 29.3 (in Thai), which uses everything on this page on rods, rings, disks and arcs. In English, the series continues with Transformers through integrals (29.9).
Frequently asked questions
What is the difference between r and r′ (r prime)?
r is the position vector of the point where you want the field (the field point). r′ is the position vector of the piece of charge or current that causes it (the source point). The prime is only a label. When you integrate, r′ moves over the whole source while r stays fixed.
Which way does R = r − r′ point?
Always from the source to the field point, because r′ + R = r. Its length is the distance between the two points, and R̂ = R/|R| is the direction of the electric field of a positive charge at that point.
Why does dV in spherical coordinates contain r² sin θ?
Because the small volume has edges dr, r dθ and r sin θ dφ. The second and third are arc lengths (radius times angle), and the circle around the z axis at angle θ has radius r sin θ. Multiplying the three edges gives r² sin θ dr dθ dφ.
Why can't I pull a_ρ out of an integral?
Because a_ρ is not constant. Its direction depends on the angle φ of each point: at φ = 0 it points along +x, at φ = 180° along −x. Before integrating a vector, write it in Cartesian components a_x, a_y, a_z, which point the same way everywhere.
Which coordinate system should I use?
Use the one that matches the shape. Boxes and sheets use Cartesian coordinates; wires, coaxial cables, solenoids and anything symmetric about an axis use cylindrical; point charges, spheres and shells use spherical. The right choice makes the limits of the integral constants.
Mod
Ajarn Mod · Teerawut Savangboon Lecturer in Electrical Engineering, Dhonburi Rajabhat University, Samut Prakan, Thailand · Profile