Let \(u = \arctan\left(\frac{1}{2}x\right)\) and \(dv = dx\). Then \(du = \frac{1}{1+\left(\frac{1}{2}x\right)^2} \cdot \frac{1}{2} \, dx = \frac{1}{4+x^2} \, dx\) and \(v = x\).
Using integration by parts, \(\int u \, dv = uv - \int v \, du\), we have:
\(\int \arctan\left(\frac{1}{2}x\right) \, dx = x \arctan\left(\frac{1}{2}x\right) - \int x \cdot \frac{1}{4+x^2} \, dx\).
Now, solve \(\int x \cdot \frac{1}{4+x^2} \, dx\) using substitution. Let \(w = 4 + x^2\), then \(dw = 2x \, dx\), so \(x \, dx = \frac{1}{2} \, dw\).
Thus, \(\int x \cdot \frac{1}{4+x^2} \, dx = \frac{1}{2} \int \frac{1}{w} \, dw = \frac{1}{2} \ln |w| + C = \frac{1}{2} \ln(4+x^2) + C\).
Substitute back:
\(x \arctan\left(\frac{1}{2}x\right) - \frac{1}{2} \ln(4+x^2)\).
Evaluate from 0 to 2:
\(\left[ x \arctan\left(\frac{1}{2}x\right) - \frac{1}{2} \ln(4+x^2) \right]_0^2\).
At \(x = 2\):
\(2 \arctan(1) - \frac{1}{2} \ln(8) = 2 \cdot \frac{\pi}{4} - \frac{1}{2} \ln(8) = \frac{\pi}{2} - \ln(2)\).
At \(x = 0\):
\(0 \cdot \arctan(0) - \frac{1}{2} \ln(4) = 0 - \ln(2)\).
Thus, the exact value is:
\(\frac{\pi}{2} - \ln(2) - (0 - \ln(2)) = \frac{\pi}{2} - \ln(2)\).