5. Find all values of the parameter $a$ for which the equation $\left(2 \sin x+a^{2}+a\right)^{3}-(\cos 2 x+3 a \sin x+11)^{3}=12-2 \sin ^{2} x+(3 a-2) \sin x-a^{2}-a$ has two distinct solutions on the interval $\left[-\frac{\pi}{6} ; \frac{3 \pi}{2}\right]$. Specify these solutions for each found $a$.

Solution: $\left(2 \sin x+a^{2}+a\right)^{3}-(\cos 2 x+3 a \sin x+11)^{3}=-2 \sin ^{2} x+(3 a-2) \sin x-a^{2}-a+12 \Leftrightarrow$ $\left(2 \sin x+a^{2}+a\right)^{3}+2 \sin x+a^{2}+a=(\cos 2 x+3 a \sin x+11)^{3}+1-2 \sin ^{2} x+3 a \sin x+11 \Leftrightarrow$

$\left(2 \sin x+a^{2}+a\right)^{3}+2 \sin x+a^{2}+a=(\cos 2 x+3 a \sin x+11)^{3}+\cos 2 x+3 a \sin x+11$

Consider the function $f(t)=t^{3}+t$. The function $f(t)$ is increasing on the entire number line.

Let $u=2 \sin x+a^{2}+a, \quad v=\cos 2 x+3 a \sin x+11$. Then we have the equation $f(u)=f(v)$, and due to the strict monotonicity of the function $f$, we arrive at the equation $u=v$, i.e., $2 \sin x+a^{2}+a=\cos 2 x+3 a \sin x+11$. The last equation is equivalent to the following $2 \sin ^{2} x-(3 a-2) \sin x+a^{2}+a-12=0$. It is necessary to find all values of the parameter $a$ for which this equation has two distinct solutions on the interval $\left[-\frac{\pi}{6} ; \frac{3 \pi}{2}\right]$. Make the substitution: $y=\sin x$. We arrive at the equation $2 y^{2}-(3 a-2) y+a^{2}+a-12=0$. To satisfy the condition of the problem, one root of this equation must belong to the interval $[-0.5 ; 1)$, and the other, if it exists, must not belong to the interval $[-1 ; 1]$, or this equation must have two distinct solutions belonging to the set $[-1 ;-0.5) \cup\{1\}$. The discriminant of the equation $D=(3 a-2)^{2}-8 a^{2}-8 a+96=(a-10)^{2}$. The only solution will be at $a=10$, this solution is $y=7$. In all other cases, we have two distinct solutions $y_{1}=a-3$ and $y_{2}=0.5 a+2$.

1) $-0.5 \leq a-31 \Rightarrow a \in[2.5 ; 4), \sin x=a-3, x_{1}=\arcsin (a-3)$, $x_{2}=\pi-\arcsin (a-3)$.
2) $-0.5 \leq 0.5 a+21 \Rightarrow a \in[-5 ;-2)$, $\sin x=0.5 a+2, x_{1}=\arcsin (0.5 a+2)$, $x_{2}=\pi-\arcsin (0.5 a+2)$.

The equation cannot have two distinct solutions belonging to the set $[-1 ;-0.5) \cup\{1\}$.
Answer: $a \in[2.5, 4), x_{1}=\arcsin (a-3), x_{2}=\pi-\arcsin (a-3)$;

$$
a \in[-5, -2), x_{1}=\arcsin (0.5 a+2), x_{2}=\pi-\arcsin (0.5 a+2)
$$