What operation is required when I would take the 'inverse of a vector'? I am working on brushing up my linear algebra knowledge and have stumbled over the following problem.
Assume we have $$Wx + \lambda a = 0$$ where $W$ a diagonal square Matrix, $x$ a conformable column vector, $\lambda$ a scalar, and $a$ a column vector of dimensions conformable to $Wx$. Intuitively I just wanted to solve for $\lambda$ as $$\lambda=(-Wx)a^{-1}$$ just before realizing that I do not know any definition of the inverse of a vector. So perhaps my thinking goes wrong here. Can you help me finding the solution to this linear system of equations?
The background of this question is a lagrange multiplier optimization with function $f(x)=x^T W x$ and constraint $g(x)=a^Tx+a_0$ ($a_0$ a scalar) where after taking the gradient of Lagrangian $L=f(x)+\lambda g(x)$ I am left with the equation in question (with constraint $a^Tx+a_0$).
 A: You can't do the “inverse of a vector”. Following the hint, instead, you can multiply by $x^T$ to the left, getting
$$
x^TWx+\lambda(x^Ta)=0
$$
Now $x^TWx$ and $x^Ta$ are numbers (actually $1\times 1$ matrices, but it doesn't make a difference). If $x^Ta\ne0$, the solution is
$$
\lambda=-\frac{x^TWx}{x^Ta}
$$
A: If $\mathrm a \neq 0_n$, then left-multiplying both sides of $\mathrm W \mathrm x + \lambda \mathrm a = \mathrm 0_n$ by $\dfrac{\mathrm a^\top}{\mathrm a^\top \mathrm a}$, we obtain
$$\dfrac{\mathrm a^\top \mathrm W \mathrm x}{\mathrm a^\top \mathrm a} + \lambda \dfrac{\mathrm a^\top \mathrm a}{\mathrm a^\top \mathrm a} = 0$$
and, thus,
$$\lambda = - \dfrac{\mathrm a^\top \mathrm W \mathrm x}{\mathrm a^\top \mathrm a}$$
Hence, the left inverse of column vector $\mathrm a$ is the row vector $\dfrac{\mathrm a^\top}{\mathrm a^\top \mathrm a}$.
A: It doesn't work that way. Instead you should first solve to find $x$ (by using the inverse of $W$, provided that the diagonal has no zero elements) as a function of $\lambda$ and then plug that value of $x$ into the constraint equation to find $\lambda$.
