Solve tangent of $y=\left(\log_{a}{x}\right)^2$ and $y=-ax+2$ How can I solve the tangent point and $a$ when $f(x)=\left(\log_{a}{x}\right)^2$ is tangent to $g(x)=-ax+2$?
Although this can be solved by substituting $a=e^2$ and $x=e^{-2}$, then
$f\left(e^{-2}\right)=g\left(e^{-2}\right)$ and $f^\prime\left(e^{-2}\right)=g^\prime\left(e^{-2}\right)$ can be proved,
is there any general solution for this, rather than just substituting random numbers? Maybe using Lambert-W could help?
 A: One cannot continuously attack this question algebraically (there is no general solution for $x$ without $a$), seeing that $(\log_a{x})^2 = -ax+2$, will eventually end up in a form similar to$f(x)e^{f(x)} = g(a)$ or $h(x)^{t(x)} = r(a)^{p(a)}$, where both need applications of Lambert-W functions to continue.
Instead, we have to restrict the domain and analyse the nature of solutions. This goes as such:
Analysing domain and nature of functions
Let $f(x) = \log_a^2{x} = \big(\frac{\ln{x}}{\ln{a}}\big)^2$, then $f'(x) = \frac{2\ln{x}}{x\cdot\ln^2{a}}, a>0, a ≠ 1$
and
$g(x) = -ax+2$, then $g'(x) = -a$
By equating $f'(x) = 0$, we see that function has a minimum at $x = 1$ regardless of $a$, and this is a minimum because of the +parabolic nature of $f(x)$ in the form $t^2$.
From this we can judge $f(x)$ is strictly decreasing for $x \in (0, 1)$ and strictly increasing for $x > 1$ $[1]$
Since $g'(x) = -a$ and $a > 0, \implies g'(x) < 0 \implies g(x)$ is strictly decreasing $[2]$
Comparing $[1]$ and $[2]$ we observe solutions for $\color{red}{x \in (0, 1)}$ only.
Analysing nature of solutions to $f(x) = g(x)$
We observed that $f'(x), g'(x) < 0, \text{ } x \in (0,1)$. This suggests only $1$ solution to
$$\{x\} \begin{cases} f(x) = g(x) \\ f'(x) = g'(x) \end{cases}$$
which is the point of tangency.
Now, observe $g(x) = f(x) = 1$ is always a solution of $x$ and it is regardless of $a$.

$1 = -ax + 2 \to x = \frac{1}{a} \text{ and } f(\frac{1}{a}) = 1$

Hence, $\exists\{x_T, a_T\}$ such that $f(x_T) = g(x_T) = 1$ and $f'(x_T) = g'(x_T)$ and $\{x_T, a_T\}$ is the only set of tangent solution, with $x_T = \frac{1}{a_T}$
Therefore,
$$f'(\frac{1}{a}) = g'(\frac{1}{a})$$
$$\frac{2\ln{\frac{1}{a}}}{\frac{1}{a}\big(\ln{a}\big)^2} = -a$$
$$-\frac{2\ln{a}}{\big(\ln{a}\big)^2} = -1$$
$$\frac{2}{\ln{a}} = 1$$
$$\therefore a = e^2 \text{ and } x = \frac{1}{e^2} = e^{-2} \in (0, 1) \text{ as required }$$
A: for real $a,x$
$$\frac{d}{dx}\left(\log_a(x)^2\right)=\frac{d}{dx}\left(-ax+2\right)$$
$$\frac{2\ln(x)}{\ln(a)^2x}=-a$$
$a\to e^t$:
$$t^2e^t=-\frac{2\ln(x)}{x}$$
$$\sqrt{t^2e^t}=\sqrt{-2\frac{\ln(x)}{x}}$$
$$te^{\frac{1}{2}t}=\pm\sqrt{-2\frac{\ln(x)}{x}}$$
$$\frac{1}{2}te^{\frac{1}{2}t}=\pm\frac{1}{2}\sqrt{-2\frac{\ln(x)}{x}}$$
$k\in\{-1,0\}$:
$$\frac{1}{2}t=W_k\left(\pm\frac{1}{2}\sqrt{-2\frac{\ln(x)}{x}}\right)$$
$$t=2W_k\left(\pm\frac{1}{2}\sqrt{-2\frac{\ln(x)}{x}}\right)$$
$$a=e^{2W_k\left(\pm\frac{1}{2}\sqrt{-2\frac{\ln(x)}{x}}\right)}$$
$$a=-\frac{1}{2}\frac{\ln(x)}{x\ W_k\left(\pm\frac{1}{2}\sqrt{-2\frac{\ln(x)}{x}}\right)^2}$$
$$a=-\frac{1}{2}\frac{\ln(x)}{x\ W_k\left(\pm\frac{1}{\sqrt{-\frac{2x}{\ln(x)}}}\right)^2}$$
