<s>[INST] Evaluating an indefinite cosine integral Evaluate $$\int\frac{1+2\cos x}{(\cos x+2)^2} dx$$ The problem looks easy but I don't think it is. Please just don't give hints for possible substitutions as I myself have tried quite many and all of them are just taking too long to solve. Thanks.
 [/INST] $$\int  \frac { 1+2\cos  x }{ (\cos  x+2)^{ 2 } } dx=2\int { \frac { \cos ^{ 2 }{ x } +\sin ^{ 2 }{ x } +2\cos { x }  }{ { \left( \cos  x+2 \right)  }^{ 2 } }  } dx=\int { \frac { \cos { x } \left( \cos { x } +2 \right) +\sin ^{ 2 }{ x }  }{ { \left( \cos  x+2 \right)  }^{ 2 } }  } dx=\\ =\int { \frac { { { \left( \sin { x }  \right)  }^{ \prime  }\left( \cos { x } +2 \right) -\sin { x{ \left( \cos { x } +2 \right)  }^{ \prime  } }  } }{ { \left( \cos  x+2 \right)  }^{ 2 } }  } dx=\int { d\left( \frac { \sin { x }  }{ { \cos  x+2 } }  \right)  } =\frac { \sin { x }  }{ { \cos  x+2 } } +C$$
</s>