Let ax=y. The original function is then changed to
g(y)=y2+3y−2, which is increasing over (−23,+∞).
When 0<a<1, we have y∈[a,a−1] and
g(y)max=a−2+3a−1−2=8⇒a−1=2⇒a=21.
Then
g(y)min=(21)2+3×21−2=−41.
When a>1, we have y∈[a−1,a] and
g(y)max=a2+3a−2=8⇒a=2.
Then
g(y)min=2−2+3×2−1−2=−41.
In summary, the minimum value of f(x) on x∈[−1,1] is −41.