To solve the integral \( I = \int_{0}^{\pi} |\cos x|^3 \, dx \), we first need to analyze the behavior of the function \( |\cos x| \) over the interval from \( 0 \) to \( \pi \).
### Step 1: Break the integral into two parts
The function \( \cos x \) is positive in the interval \( [0, \frac{\pi}{2}] \) and negative in the interval \( [\frac{\pi}{2}, \pi] \). Therefore, we can break the integral as follows:
\[
I = \int_{0}^{\frac{\pi}{2}} \cos^3 x \, dx + \int_{\frac{\pi}{2}}^{\pi} (-\cos x)^3 \, dx
\]
Since \( (-\cos x)^3 = -\cos^3 x \), we can rewrite the second integral:
\[
I = \int_{0}^{\frac{\pi}{2}} \cos^3 x \, dx - \int_{\frac{\pi}{2}}^{\pi} \cos^3 x \, dx
\]
### Step 2: Change the limits of the second integral
To evaluate the second integral, we can change the variable. Let \( u = \pi - x \). Then \( du = -dx \), and when \( x = \frac{\pi}{2} \), \( u = \frac{\pi}{2} \) and when \( x = \pi \), \( u = 0 \). Thus, the integral becomes:
\[
\int_{\frac{\pi}{2}}^{\pi} \cos^3 x \, dx = \int_{\frac{\pi}{2}}^{0} \cos^3(\pi - u)(-du) = \int_{0}^{\frac{\pi}{2}} (-\cos u)^3 \, du = -\int_{0}^{\frac{\pi}{2}} \cos^3 u \, du
\]
So we have:
\[
I = \int_{0}^{\frac{\pi}{2}} \cos^3 x \, dx - (-\int_{0}^{\frac{\pi}{2}} \cos^3 x \, dx) = 2\int_{0}^{\frac{\pi}{2}} \cos^3 x \, dx
\]
### Step 3: Evaluate the integral \( \int_{0}^{\frac{\pi}{2}} \cos^3 x \, dx \)
To evaluate \( \int \cos^3 x \, dx \), we can use the identity:
\[
\cos^3 x = \cos x (1 - \sin^2 x) = \cos x - \cos x \sin^2 x
\]
Thus,
\[
\int \cos^3 x \, dx = \int \cos x \, dx - \int \cos x \sin^2 x \, dx
\]
The first integral is straightforward:
\[
\int \cos x \, dx = \sin x
\]
For the second integral, we can use the substitution \( u = \sin x \), \( du = \cos x \, dx \):
\[
\int \cos x \sin^2 x \, dx = \int u^2 \, du = \frac{u^3}{3} = \frac{\sin^3 x}{3}
\]
Thus,
\[
\int \cos^3 x \, dx = \sin x - \frac{\sin^3 x}{3}
\]
Now, we evaluate this from \( 0 \) to \( \frac{\pi}{2} \):
\[
\int_{0}^{\frac{\pi}{2}} \cos^3 x \, dx = \left[ \sin x - \frac{\sin^3 x}{3} \right]_{0}^{\frac{\pi}{2}} = \left( 1 - \frac{1}{3} \right) - \left( 0 - 0 \right) = 1 - \frac{1}{3} = \frac{2}{3}
\]
### Step 4: Calculate the final value of \( I \)
Now substituting back into our expression for \( I \):
\[
I = 2 \int_{0}^{\frac{\pi}{2}} \cos^3 x \, dx = 2 \cdot \frac{2}{3} = \frac{4}{3}
\]
### Final Answer
Thus, the value of the integral \( \int_{0}^{\pi} |\cos x|^3 \, dx \) is:
\[
\boxed{\frac{4}{3}}
\]