4. Determine the primitives of the function $f:(0, \pi) \rightarrow \mathbb{R}, f(x)=\frac{\sin x-\cos x}{1+|\cos x|} \cdot e^{x}$.

## Note:

- All questions are mandatory;
- Time allowed: 3 hours.


## Solutions for 12th grade:




Translate the above text into English, please retain the original text's line breaks and format, and output the translation result directly.
4. Let $I_{1}=\int \frac{\sin x-\cos x}{1+\cos x} \cdot e^{x} d x, x \in(0, \pi)$ and $I_{2}=\int \frac{\sin x-\cos x}{1-\cos x} \cdot e^{x} d x, x \in(0, \pi)$. We have:

$\frac{1}{2}\left(I_{1}+I_{2}\right)=\int \frac{\sin x-\cos x}{\sin ^{2} x} \cdot e^{x} d x=\int \frac{e^{x}}{\sin x} d x+\int\left(\frac{1}{\sin x}\right)^{\prime} \cdot e^{x} d x=\frac{e^{x}}{\sin x}+C$ (1) and

$\frac{1}{2}\left(I_{2}-I_{1}\right)=\int \frac{\sin x-\cos x}{\sin ^{2} x} \cdot \cos x \cdot e^{x} d x=\int e^{x} \frac{\cos x}{\sin x} d x+\int\left(\frac{1}{\sin x}\right)^{\prime} \cdot e^{x} \cos x d x=\int e^{x} \frac{\cos x}{\sin x} d x+e^{x} \frac{\cos x}{\sin x}-$ $-\int \frac{e^{x} \cos x-e^{x} \sin x}{\sin x} d x=e^{x} \cdot \frac{\sin x+\cos x}{\sin x}+C$. (2)

From (1) and (2) it follows that a primitive of $f$ is of the form:

$$
F(x)= \begin{cases}\frac{e^{x}}{\sin x} \cdot(1-\cos x-\sin x)+C_{1}, & x \in\left(0, \frac{\pi}{2}\right) \\ C_{2}, & x=\frac{\pi}{2} \\ \frac{e^{x}}{\sin x} \cdot(1+\cos x+\sin x)+C_{3}, & x \in\left(\frac{\pi}{2}, \pi\right)\end{cases}
$$

From the condition that $F$ is continuous at $x=\frac{\pi}{2}$, we obtain $C_{1}=C_{2}=C_{3}+e^{\frac{\pi}{2}}$ and it is immediately verified that $F$ is differentiable at $x=\frac{\pi}{2}$.