<s>[INST] What is the minimum value of $a+b+\frac{1}{ab}$ if $a^2 + b^2 = 1$? For the case when $a,b>0,$ I used AM-GM Inequality as follows that:
$\frac{(a+b+\frac{1}{ab})}{3} \geq (ab\frac{1}{ab})^\frac{1}{3}$
This implies that $(a+b+\frac{1}{ab})\geq 3$. Hence, the minimum value of $(a+b+\frac{1}{ab})$ is 3
But the answer is $2+\sqrt{2}$ ... how is it ?
 [/INST] Let the minimum value of $a+b+\frac{1}{ab} = k$. Both curves must be tangent to each other, which means they must have the same gradient. Thus $a^2 + b^2  = 1 \implies \frac{db}{da} = -\frac{a}{b}$, and:
$$a+b+\frac{1}{ab} = k \implies 1 + \frac{db}{da} - \frac{1 + db/da}{(ab)^2} = 0$$
$$\implies (ab)^2 \left(1 - \frac{a}{b} \right) - 1 - -\frac{a}{b} = 0$$
$$\implies a^2b^2 - a^3b - 1 + \frac{a}{b}  =0$$
$$\implies a^2b^3 - a^3b^2 - b + a = 0$$
$$\implies a^2b^2(b-a) - (b-a)  =0$$
$$\implies (ab+1)(ab-1)(b-a) = 0$$
but only $b-a = 0$ intersects with $a^2 + b^2 = 1$. This gives $a = b = \frac{1}{\sqrt2}$, and hence $k = \frac{1}{\sqrt2} + \frac{1}{\sqrt2} + \frac{1}{1/2} = 2 + \sqrt{2}$.
</s>