(a) To find the equation of the tangent, we first need the derivative of \(y = x \cos 2x\). Using the product rule:
\(\frac{dy}{dx} = \frac{d}{dx}(x) \cdot \cos 2x + x \cdot \frac{d}{dx}(\cos 2x)\)
\(= \cos 2x - 2x \sin 2x\)
At \(x = \frac{1}{2} \pi\), \(y = x \cos 2x = \frac{1}{2} \pi \cdot \cos \pi = -\frac{\pi}{2}\).
\(\frac{dy}{dx} = \cos \pi - 2 \cdot \frac{1}{2} \pi \cdot \sin \pi = -1\).
The equation of the tangent is \(y - (-\frac{\pi}{2}) = -1(x - \frac{1}{2} \pi)\).
Simplifying gives \(x + y = 0\).
(b) To find the area of the shaded region, integrate \(y = x \cos 2x\) from \(x = 0\) to \(x = \frac{\pi}{4}\).
Using integration by parts, let \(u = x\) and \(dv = \cos 2x \, dx\), then \(du = dx\) and \(v = \frac{1}{2} \sin 2x\).
\(\int x \cos 2x \, dx = \frac{1}{2} x \sin 2x - \int \frac{1}{2} \sin 2x \, dx\)
\(= \frac{1}{2} x \sin 2x + \frac{1}{4} \cos 2x\).
Evaluate from \(x = 0\) to \(x = \frac{\pi}{4}\):
\(\left[ \frac{1}{2} x \sin 2x + \frac{1}{4} \cos 2x \right]_0^{\frac{\pi}{4}}\)
\(= \left( \frac{1}{2} \cdot \frac{\pi}{4} \cdot \sin \frac{\pi}{2} + \frac{1}{4} \cdot \cos \frac{\pi}{2} \right) - \left( 0 + \frac{1}{4} \cdot 1 \right)\)
\(= \frac{\pi}{8} - \frac{1}{4}\).