Let, P≡(a2,a+1), L1:3x−y+1=0 and L2:x+2y−5=0.
Now, origin and P lies on the same side with respect to line L1.
⇒L1(0)⋅L1(P)>0
⇒3(a2)−(a+1)+1>0

⇒3a2−a>0
⇒a(3a−1)>0

⇒a∈(−∞,0)∪(31,∞)...(i)
Now, L2:x+2y−5=0
Origin and P lies on same side with respect to L2
⇒L2(0)⋅L2(P)>0
⇒a2+2(a+1)−5<0
⇒a2+2a−3<0
⇒(a+3)(a−1)<0

∴a∈(−3,1)...(ii)
Using intersection of (i)and(ii),

⇒a∈(−3,0)∪(31,1)