4. Let $A$ and $B$ be independent events. In terms of $\mathrm{P}(A)$ and $\mathrm{P}(B)$, express the probabilities of the events consisting in exactly $k$, at least $k$, and at most $k$ of the events $A$ and $B$, $k=0,1,2$.
Solution. For brevity, let $a:=\mathrm{P}(A), b:=\mathrm{P}(B)$, $\xi$ - the number of events that occurred. Then

$$
\mathrm{P}(\xi \leqslant 2)=\mathrm{P}(\xi \geqslant 0)=1 \quad(\text { since for any outcome } 0 \leqslant \xi \leqslant 2) \text {. }
$$

Further,

$$
\begin{aligned}
& p_{0}:=\mathrm{P}(\xi=0)=\mathrm{P}(\xi \leqslant 0)=1-\mathrm{P}(A \cup B)= \\
&=\mathrm{P}(\overline{A \cup B})=\mathrm{P}(\bar{A} \cap \bar{B})=(1-a)(1-b)=1-a-b+a b ; \\
& p_{1}:=\mathrm{P}(\xi=1)=\mathrm{P}(A \backslash B)+\mathrm{P}(B \backslash A)=\mathrm{P}(A \backslash A B)+\mathrm{P}(B \backslash A B)= \\
&=\mathrm{P}(A)-\mathrm{P}(A B)+\mathrm{P}(B)-\mathrm{P}(A B)=a+b-2 a b ; \\
& p_{2}:=\mathrm{P}(\xi=2)=\mathrm{P}(\xi \geqslant 2)=\mathrm{P}(A B)=a b ; \\
& \mathrm{P}(\xi \geqslant 1)=p_{1}+p_{2}=a+b-a b ; \\
& \mathrm{P}(\xi \leqslant 1)=p_{0}+p_{1}=1-a b .
\end{aligned}
$$