Consider the vector field given by (\(\mu_0\) and \(I\) are constants):
\(\boldsymbol{\vec{B}}
= {\mu_0 I\over2\pi} \left({y\,\boldsymbol{\hat{x}}+x\,\boldsymbol{\hat{y}}\over x^2+y^2}\right)
= {\mu_0 I\over2\pi} \, {\boldsymbol{\hat{\phi}}\over r}
\)
\(\boldsymbol{\vec{B}}\) is the magnetic field around a wire along the \(z\)axis carrying a constant current \(I\) in the \(z\)direction.
Ready:

Determine \(\boldsymbol{\vec{B}}\cdot d\boldsymbol{\vec{r}}\) on any radial line of the form \(y=mx\), where \(m\) is a constant.

Determine \(\boldsymbol{\vec{B}}\cdot d\boldsymbol{\vec{r}}\) on any circle of the form \(x^2+y^2=a^2\), where \(a\)
is a constant.
You may wish to express the equations for these curves in polar
coordinates.
Go:
For each of the following curves \(C_i\), evaluate the line integral
\(\int\limits_{C_i}\boldsymbol{\vec{B}}\cdot d\boldsymbol{\vec{r}}\).

\(C_1\), the top half of the circle \(r=5\), traversed in a
counterclockwise direction.

\(C_2\), the top half of the circle \(r=2\), traversed in a
counterclockwise direction.

\(C_3\), the top half of the circle \(r=2\), traversed in a
clockwise direction.

\(C_4\), the bottom half of the circle \(r=2\), traversed in a
clockwise direction.

\(C_5\), the radial line from \((2,0)\) to \((5,0)\).

\(C_6\), the radial line from \((5,0)\) to \((2,0)\).
FOOD FOR THOUGHT

Construct closed curves \(C_7\) and \(C_8\) such that this integral \(\int\limits_{C_i}\boldsymbol{\vec{B}}\cdot d\boldsymbol{\vec{r}}\)
is nonzero over \(C_7\) and zero over \(C_8\).
It is enough to draw your curves; you do not need to
parameterize them.

Ampère's Law says that, for any closed curve \(C\), this integral is (\(\mu_0\) times) the current flowing through \(C\) (in the \(z\) direction). Can you use this fact to explain your results to part (a)?

Is \(\boldsymbol{\vec{B}}\) conservative?
Main ideas

Calculating (vector) line integrals.

Use what you know!
Prerequisites

Familiarity with \(d\boldsymbol{\vec{r}}\).

Familiarity with “Use what you know” strategy.
Warmup
This activity should be preceded by a short lecture on (vector) line
integrals, which emphasizes that \(\int_C\boldsymbol{\vec{F}}\cdot d\boldsymbol{\vec{r}}\) represents chopping up
the curve into small pieces. Integrals are sums; in this case, one is adding
up the component of \(\boldsymbol{\vec{B}}\) parallel to the curve times the length of each
piece.
Wrapup
Emphasize that students must express everything in terms of a single variable
prior to integration.
Point out that in polar coordinates (and basis vectors)
\begin{eqnarray*}
\boldsymbol{\vec{B}}= {\mu_0 I\over2\pi} {\boldsymbol{\hat{\phi}}\over r}
\end{eqnarray*}
so that using \(d\boldsymbol{\vec{r}} = dr\,\boldsymbol{\hat{r}} + r\,d\phi\,\boldsymbol{\hat{\phi}}\) quickly yields \(\boldsymbol{\vec{B}}\cdot
dd\boldsymbol{\vec{r}}\) along a circular arc (\({\mu_0 I\over2\pi}\,d\phi\)) or a radial line
(\(0\)), respectively.
Details
In the Classroom

Sketching the vector field takes some students a long time. If time is short,
have them do this before class, or consider using MATLAB or similar technology to plot the field. Still, it's important to plot a few vectors by hand.

Students who have not had physics don't know which way the current goes; they
may need to be told about the righthand rule.

Some students may confuse the wire with the paths of integration.

Students working in rectangular coordinates often get lost in the algebra of
Question 2b. Make sure that nobody gets stuck here.

Students who calculate \(\boldsymbol{\vec{B}}\cdot d\boldsymbol{\vec{r}}={dy\over x}\) on a circle need to be
reminded that at the end of the day a line integral must be expressed in terms
of a single variable.

Some students will be surprised when they calculate \(\boldsymbol{\vec{B}}\cdot d\boldsymbol{\vec{r}}=0\) for
radial lines. They should be encouraged to think about the directions of
\(\boldsymbol{\vec{B}}\) and \(d\boldsymbol{\vec{r}}\).

Most students will either write everything in terms of \(x\) or \(y\) or switch to
polar coordinates. We discuss each of these in turn.

This problem cries out for polar coordinates. Along a circular arc, \(r=a\)
yields \(x=a\cos\phi\), \(y=a\sin\phi\), so that
\(d\boldsymbol{\vec{r}}=a\sin\phi\,d\phi\,\boldsymbol{\hat{x}}+a\cos\phi\,d\phi\,\boldsymbol{\hat{y}}\), from which one gets
\(\boldsymbol{\vec{B}}\cdot d\boldsymbol{\vec{r}} = {\mu_0 I\over2\pi}\,d\phi\).

Students who fail to switch to polar coordinates can take the differential of
both sides of the equation \(x^2+y^2=a^2\), yielding \(x\,dx+y\,dy=0\), which can
be solved for \(dx\) (or \(dy\)) and inserted into the fundamental formula
\(d\boldsymbol{\vec{r}}=dx\,\boldsymbol{\hat{x}}+dy\,\boldsymbol{\hat{y}}\). Taking the dot product then yields,
\(
\boldsymbol{\vec{B}}\cdot d\boldsymbol{\vec{r}}= {\mu_0 I\over2\pi} {dy\over x}
\).
Students may get stuck here, not realizing that they need to write \(x\) in
terms of \(y\). The resulting integral cries out for a trig substitution 
which is really just switching to polar coordinates.
In either case, sketching \(\boldsymbol{\vec{B}}\) should convince students that \(\boldsymbol{\vec{B}}\) is tangent
to the circular arcs, hence orthogonal to radial lines. Thus, along such
lines, \(\boldsymbol{\vec{B}}\cdot d\boldsymbol{\vec{r}}=0\); no calculation is necessary.
(This calculation is straightforward even in rectangular coordinates.)

Watch out for folks who go from \(r^2=x^2+y^2\) to
\(d\boldsymbol{\vec{r}} = 2x\,dx\,\boldsymbol{\hat{x}} + 2y\,dy\,\boldsymbol{\hat{y}}\).

Working in rectangular coordinates leads to an integral of the form
\(\int{dx\over y}\), with \(y=\sqrt{r^2x^2}\). Maple integrates this to
\(\tan^{1}\left({x\over y}\right)\), which many students will not recognize
as the polar angle \(\phi\). If \(r=1\), Maple instead integrates this to
\(\sin^{1}x\); same problem. One calculator (the TI89?) appears to use
arcsin in both cases.
Homework

Any vector line integral for which the path is given geometrically, that is,
without an explicit parameterization.
Essay questions

Discuss when \(\oint\boldsymbol{\vec{B}}\cdot d\boldsymbol{\vec{r}}\) around a closed curve will or will not be
zero.
Enrichment

This activity leads naturally into a discussion of path independence.

Point out that \(\boldsymbol{\vec{B}}\sim\nabla\phi\) everywhere (except the origin), but that
\(\boldsymbol{\vec{B}}\) is only conservative on domains where \(\phi\) is singlevalued.

Discuss winding number, perhaps pointing out that \(\boldsymbol{\vec{B}}\cdot d\boldsymbol{\hat{r}}\) is
proportional to \(d\phi\) along any curve.

Discuss Ampère's Law, which says that \(\oint\!\boldsymbol{\vec{B}}\cdot d\boldsymbol{\vec{r}}\) is
(\(\mu_0\) times) the current flowing through \(C\) (in the \(z\)
direction).