A current is a crowd of moving charges, so a wire in a magnetic field feels the sum of all their Lorentz forces. In Physics 2 that sum was $ILB\sin\theta$ for a straight wire in a uniform field. For bent wires and changing fields, add it up piece by piece.
Key idea
$$d\vec{F} = I\,d\vec{\ell}\times\vec{B}, \qquad \vec{F} = I\int d\vec{\ell}\times\vec{B}.$$
In a uniform field this becomes $\vec{F} = I\,\vec{L}\times\vec{B}$, where $\vec{L}$ is the straight-line displacement from the wire's start to its end, whatever its shape. A closed loop in a uniform field feels no net force.
Why it works
A piece of wire of length $d\ell$ holds charge $dq$ moving at $\vec{v}$, and $dq\,\vec{v} = I\,d\vec{\ell}$ (charge per time times distance). So each piece feels $dq\,\vec{v}\times\vec{B} = I\,d\vec{\ell}\times\vec{B}$. If $\vec{B}$ is the same everywhere, $I$ and $\vec{B}$ come out of the integral, leaving $\int d\vec{\ell}$: the sum of all the little steps along the wire, which is just the displacement from start to finish. Around a closed loop you end where you started, so that sum is zero.
Worked examples
Worked example: A half circle
A wire bent into a half circle of radius $10\ \text{cm}$ carries $4.0\ \text{A}$ in a uniform $0.50\ \text{T}$ field perpendicular to its plane. Find the force.
- The displacement from one end to the other is a diameter, $2R = 0.20\ \text{m}$, perpendicular to $\vec{B}$.
- $F = I(2R)B = (4.0)(0.20)(0.50) = 0.400\ \text{N}$.
- Check by integrating: each piece feels $IBR\,d\phi$ pointing outward; the parts along the diameter cancel, and the rest add to $\int_0^\pi IBR\sin\phi\,d\phi = 2IBR$.
Answer: $F = 0.400\ \text{N}$
Worked example: Any path, same answer
A wire carrying $3.0\ \text{A}$ wanders from $(0, 0)$ to $(0.30, 0.40)\ \text{m}$ in a uniform $0.20\ \text{T}$ field along $+z$. Find the size of the force.
- Only the displacement counts: $|\vec{L}| = \sqrt{0.30^2 + 0.40^2} = 0.50\ \text{m}$, perpendicular to $\vec{B}$.
- $F = ILB = (3.0)(0.50)(0.20) = 0.300\ \text{N}$.
Answer: $F = 0.300\ \text{N}$
Worked example: A field that changes along the wire
A long wire carries $20\ \text{A}$. A rod carrying $5.0\ \text{A}$ lies perpendicular to it, from $2.0$ to $10\ \text{cm}$ away. Find the force on the rod.
- Now $\vec{B}$ is not uniform: $B = \dfrac{\mu_0 I_1}{2\pi r}$, perpendicular to the rod all along it.
- $$F = \int_a^b I_2\frac{\mu_0 I_1}{2\pi r}\,dr = \frac{\mu_0I_1I_2}{2\pi}\ln\frac{b}{a} = (2 \times 10^{-7})(20)(5.0)\ln 5$$
- $F = 3.22 \times 10^{-5}\ \text{N}$, or about $32.2\ \mu\text{N}$.
Answer: $F \approx 32.2\ \mu\text{N}$
Common mistake
"A current loop in a uniform field is pushed sideways." Each side does feel a force, but the forces on opposite sides are equal and opposite, and around the whole loop they add to zero, since $\oint d\vec{\ell} = 0$. What the loop can feel is a torque, which turns it without moving it, and that is how motors work. A loop is pushed as a whole only when the field is stronger on one side than the other.