Step 1: Let \( \sin^2 x = t \).
Substituting, we get the quadratic in \( t \):
\[
t^2 - (p+2)t - (p+3) = 0
\]
where \( 0 \leq t \leq 1 \) since \( t = \sin^2 x \).
Step 2: Solve the quadratic equation.
Using the quadratic formula:
\[
t = \frac{(p+2) \pm \sqrt{(p+2)^2 + 4(p+3)}}{2}
\]
Simplify the discriminant:
\[
(p+2)^2 + 4(p+3) = p^2 + 4p + 4 + 4p + 12 = p^2 + 8p + 16
\]
Thus:
\[
t = \frac{(p+2) \pm \sqrt{p^2 + 8p + 16}}{2}
\]
Step 3: Condition for solution in \([0, 1]\).
For a solution, at least one root \( t \) must lie in \([0,1]\).
Analyze critical points:
Let’s check when \( t=0 \) or \( t=1 \).
Substitute \( t=0 \) into the quadratic:
\[
0 - 0 - (p+3) = 0 \quad \Rightarrow \quad p = -3
\]
Substitute \( t=1 \) into the quadratic:
\[
1 - (p+2)(1) - (p+3) = 0 \quad \Rightarrow \quad 1 - p -2 - p -3 = 0
\]
\[
-2p -4 = 0 \quad \Rightarrow \quad p = -2
\]
Thus, \( p \) must lie between \(-3\) and \(-2\), including endpoints.
Hence, \( p \in [-3, -2] \).