Solution (source code)

= Solution
{c}

Use the fine <matrix> $A_h$ and right-hand side from part (b), with diagonal $D_h$. Starting from an iterate $v$, take $\nu$ <weighted Jacobi> smoothing steps
$$
v\leftarrow v+\omega D_h^{-1}(b_h-A_hv),\qquad0<\omega<1.
$$
Form the residual $r_h=b_h-A_hv$. For coarse interior indices $j=1,\ldots,m/2-1$, use <full-weighting restriction>
$$
(Rr_h)_j=\tfrac14(r_{2j-1}+2r_{2j}+r_{2j+1}).
$$
The <prolongation operator> <matrix> $P$ is linear interpolation of a coarse correction: $(Pe)_{2j}=e_j$ and $(Pe)_{2j+1}=(e_j+e_{j+1})/2$, with zero endpoint corrections. Thus $R=P^T/2$. Choose the <Galerkin coarse-grid operator> $A_c=RA_hP$, solve $A_ce_c=Rr_h$ exactly, and correct $v\leftarrow v+Pe_c$. The entries of $A_h$, $R$ and $P$ above specify every <matrix> in the cycle. A rediscretized coarse operator is another standard choice if used consistently.

For a nonsingular coarse operator, the fine-grid <iteration matrix> of this pre-smoothed two-grid cycle is
$$
\boxed{E_{\rm TG}=(I-PA_c^{-1}RA_h)(I-\omega D_h^{-1}A_h)^\nu.}
$$
The purpose of under-relaxation is to damp fine-grid oscillations, leaving smoother error for coarse-grid correction. For the diffusion-dominated one-dimensional operator, $\omega=2/3$ is the usual effective choice; the high-frequency symbol $1-\omega(1-\cos\xi)$ then has modulus at most $1/3$ for $\pi/2\leq|\xi|\leq\pi$. Coefficients and convection can change the best parameter, so this is a motivated choice rather than a universal optimum. Under the diagonal-dominance condition, the unweighted Jacobi <matrix> already has <norm> less than one in the <maximum norm>, and its <convex combination> with the identity remains convergent for $0<\omega<1$.