Step 1: Understand the integral
We need to evaluate:
\[
\int_0^{2\pi} |x \sin x| \, dx = k \pi
\]
and find the value of \( k \).
Step 2: Analyze the integrand \( |x \sin x| \)
Since \( x \) is positive in \( [0, 2\pi] \), the absolute value comes from \( \sin x \).
We know that \( \sin x \) is positive in \( (0, \pi) \) and negative in \( (\pi, 2\pi) \).
Step 3: Split the integral at \( x = \pi \)
\[
\int_0^{2\pi} |x \sin x| dx = \int_0^{\pi} x \sin x \, dx + \int_{\pi}^{2\pi} |x \sin x| dx
\]
For \( x \in [\pi, 2\pi] \), \( \sin x \leq 0 \), so:
\[
|x \sin x| = -x \sin x
\]
Hence,
\[
\int_0^{2\pi} |x \sin x| dx = \int_0^{\pi} x \sin x \, dx - \int_{\pi}^{2\pi} x \sin x \, dx
\]
Step 4: Evaluate \( \int x \sin x \, dx \)
Use integration by parts:
Let \( u = x \), \( dv = \sin x \, dx \)
Then, \( du = dx \), \( v = -\cos x \)
So,
\[
\int x \sin x \, dx = -x \cos x + \int \cos x \, dx = -x \cos x + \sin x + C
\]
Step 5: Calculate the definite integrals
\[
\int_0^{\pi} x \sin x \, dx = \left[-x \cos x + \sin x\right]_0^{\pi}
\]
Evaluate at limits:
At \( x = \pi \): \( -\pi \cos \pi + \sin \pi = -\pi (-1) + 0 = \pi \)
At \( x = 0 \): \( 0 + 0 = 0 \)
So, \( \int_0^{\pi} x \sin x \, dx = \pi \)
Similarly, for \( \int_{\pi}^{2\pi} x \sin x \, dx \):
\[
\left[-x \cos x + \sin x\right]_{\pi}^{2\pi}
\]
At \( x = 2\pi \): \( -2\pi \cos 2\pi + \sin 2\pi = -2\pi (1) + 0 = -2\pi \)
At \( x = \pi \): \( -\pi \cos \pi + \sin \pi = -\pi (-1) + 0 = \pi \)
So,
\[
\int_{\pi}^{2\pi} x \sin x \, dx = (-2\pi) - (\pi) = -3\pi
\]
Step 6: Combine results
\[
\int_0^{2\pi} |x \sin x| dx = \pi - (-3\pi) = \pi + 3\pi = 4\pi
\]
Hence, \( k \pi = 4 \pi \implies k = 4 \).
Step 7: Final answer
\[
k = 4
\]