Let $I_{m}=\textstyle\int_{0}^{2 \pi} \cos (x) \cos (2 x) \cdots \cos (m x) d x .$ For which integers $m, 1 \leq m \leq 10$ is $I_{m} \neq 0 ?$
1. We start with the integral \( I_m = \int_0^{2\pi} \cos(x) \cos(2x) \cdots \cos(mx) \, dx \).

2. Using Euler's formula, we can express each cosine term as:
   \[
   \cos(kx) = \frac{e^{ikx} + e^{-ikx}}{2}
   \]
   Therefore, the integral becomes:
   \[
   I_m = \int_0^{2\pi} \prod_{k=1}^m \left( \frac{e^{ikx} + e^{-ikx}}{2} \right) \, dx
   \]

3. Expanding the product inside the integral, we get:
   \[
   I_m = 2^{-m} \int_0^{2\pi} \sum_{\epsilon_k = \pm 1} e^{i(\epsilon_1 + 2\epsilon_2 + \cdots + m\epsilon_m)x} \, dx
   \]
   Here, \(\epsilon_k\) can be either \(1\) or \(-1\).

4. Since the integral of a sum is the sum of the integrals, we can interchange the sum and the integral:
   \[
   I_m = 2^{-m} \sum_{\epsilon_k = \pm 1} \int_0^{2\pi} e^{i(\epsilon_1 + 2\epsilon_2 + \cdots + m\epsilon_m)x} \, dx
   \]

5. Recall that:
   \[
   \int_0^{2\pi} e^{itx} \, dx = \begin{cases} 
   2\pi & \text{if } t = 0 \\
   0 & \text{if } t \neq 0 
   \end{cases}
   \]
   Therefore, the integral \(\int_0^{2\pi} e^{i(\epsilon_1 + 2\epsilon_2 + \cdots + m\epsilon_m)x} \, dx\) is non-zero if and only if:
   \[
   \epsilon_1 + 2\epsilon_2 + \cdots + m\epsilon_m = 0
   \]

6. We need to find the values of \(m\) for which there exists a combination of \(\epsilon_k = \pm 1\) such that:
   \[
   \epsilon_1 + 2\epsilon_2 + \cdots + m\epsilon_m = 0
   \]

7. Consider the sum modulo 2:
   \[
   0 = \epsilon_1 + 2\epsilon_2 + \cdots + m\epsilon_m \equiv 1 + 2 + \cdots + m \equiv \frac{m(m+1)}{2} \pmod{2}
   \]
   This implies:
   \[
   \frac{m(m+1)}{2} \equiv 0 \pmod{2}
   \]

8. For \(\frac{m(m+1)}{2}\) to be even, \(m(m+1)\) must be divisible by 4. This happens if \(m \equiv 0 \pmod{4}\) or \(m \equiv 3 \pmod{4}\).

9. We now check the values of \(m\) from 1 to 10 that satisfy these conditions:
   - \(m = 3\)
   - \(m = 4\)
   - \(m = 7\)
   - \(m = 8\)

10. Therefore, the values of \(m\) for which \(I_m \neq 0\) are \(m = 3, 4, 7, 8\).

The final answer is \(\boxed{m = 3, 4, 7, 8}\)