The values of p for which one root of the equation x2−(p + 1) x+p2+p=8 exceeds 2 and the other is lesser than 2 are given by
3<p<10
p≤−2
p≥10
−2<p<3
Let f(x)=x2−(p+1)x+p2+p−8
Since one root is less than 2 and other is more than 2, 2lies between the roots
⇒ f(2)<0⇒ 4−2(p+1)+p2+p−8<0⇒ p2−p−6<0⇒ (p−3)(p+2)<0⇒ p∈(−2,3)