<s>[INST] If $x^2+ax-3x-(a+2)=0\;,$ Then $ \min\left(\frac{a^2+1}{a^2+2}\right)$ 
If $x^2+ax-3x-(a+2)=0\;,$ Then $\displaystyle \min\left(\frac{a^2+1}{a^2+2}\right)$

$\bf{My\; Try::}$ Given $x^2+ax-3x-(a+2)=0\Leftrightarrow ax-a = -(x^2-3x-2)$
So we get $$a=\frac{x^2-3x-2}{1-x} = \frac{x^2-2x+1+1-x-4}{1-x} = \left[1-x-\frac{4}{1-x}+1\right]$$
Now $$f(a) = \frac{a^2+1}{a^2+2} = \frac{a^2+2-1}{a^2+2} = 1-\frac{1}{a^2+2}$$
So $$f(x) = 1-\frac{1}{\left[(1-x)-\frac{4}{1-x}+1\right]^2+2}$$
Now put $1-x=t\;,$ Then we get $$f(t) =1- \frac{1}{\left(t-\frac{4}{t}+1\right)^2+2}$$
Now How can I maximize $\displaystyle \frac{1}{\left[(1-x)-\frac{4}{1-x}+1\right]^2+2, }\;,$ Help Required, Thanks
 [/INST] Your function will be maximum when the denominator will be minimum.
So, your work will be to calculate $$\frac{d}{dx}\left[\left\{(1-x)-\frac{4}{1-x}+1\right\}^2+1\right]=0$$
It will come down to $$2\left\{(1-x)-\frac{4}{1-x}+1\right\}\left\{-1-\frac{4}{(1-x)^2}\right\}=0$$
This will give rise to $2$ cases.
Case-$1$:
$$-1-\frac{4}{(1-x)^2}=0 \Rightarrow x \not \in \mathbb{R}$$
Hence $-1-\frac{4}{(1-x)^2}\not =0$ for any real $x$.
Case-$2$:
$$(1-x)-\frac{4}{1-x}+1=0$$
$$(1-x)^2+(1-x)-4=0$$
So $$1-x=\frac{-1\pm \sqrt{1+16}}{2}=\frac{\sqrt{17}\pm 1}{2}$$
Or $$x=1-\frac{\sqrt{17}\pm 1}{2}$$
This will give $2$ values of $x$. 
Compute $\frac{d^2}{dx^2}\left[\left\{(1-x)-\frac{4}{1-x}+1\right\}^2+1\right]$ and check for which value of $x$, the expression comes out to be positive.
That is where the function is minimised, or,  your actual function is maximised.
Hope this helps.
</s>