5. The function $f(x)=a^{2 x}+3 a^{x}-2(a>0, a \neq 1)$ has a maximum value of 8 on the interval $x \in[-1,1]$, then its minimum value on this interval is $\qquad$ .
If $a>1$, $f(x)=a^{2 x}+3 a^{x}-2$ is monotonically increasing on the interval $x \in[-1,1]$, then $f(1)=a^{2}+3 a-2=8 \Rightarrow a^{2}+3 a-10=(a-2)(a+5)=0 \Rightarrow a=2$; if $0<a<1$, $f(x)=a^{2 x}+3 a^{x}-2$ is monotonically decreasing on the interval $x \in[-1,1]$, then $f(-1)=a^{-2}+3 a^{-1}-2=8 \Rightarrow a^{-2}+3 a^{-1}-10=\left(a^{-1}-2\right)\left(a^{-1}+5\right)=0$ $\Rightarrow a^{-1}=2 \Rightarrow a=\frac{1}{2}$. Therefore, the minimum value of $f(x)$ on the interval $x \in[-1,1]$ is $-\frac{1}{4}$.