If $q\neq 0$ and $e$ are column vectors, when do we have $A$ such that $Aq=e$?

Question: if $q\neq 0$ and $e$ are $n\times 1$ column vectors, when do we have $A$ ($n\times n$) such that $Aq=e$?

I've got a feeling that such $A$ always exists. Let $q_j$ be a nonzero element of $q$ and construct the $i$-th row of $A$ as ($i=1,\ldots,n$): $$A_i'=\begin{pmatrix}0&\ldots&\underbrace{\frac{c_i}{q_j}}_{j\text{-th position}}&\ldots&0\end{pmatrix}$$ and let $$A=\begin{pmatrix}A_1'\\ \vdots \\ A_n'\end{pmatrix}\cdot$$ Did I miss something? I've been making a lot of mistakes all morning so my confidence is shaky.

• Your feeling(s) are right. – Dietrich Burde Mar 27 '15 at 15:36

I think you're in good shape, though I didn't check the details fully. Here's another way of looking at it.

Assemble a basis $Q$ of $\mathbb{R}^n$ whose first element is $q$; call $Q$ the matrix with these columns. Do the same to make a basis of $\mathbb{R}^n$, call it $E$, whose first element is $e$. Then your $A$, written as a map from $(\mathbb{R}^n,Q)$ to $(\mathbb{R}^n,E)$, should have its first column equal to $[1,0,\dots,0]^T$. The other columns are irrelevant for your needs. Now you just need to recall how to write $A$ as a matrix in the standard basis, which is

$$A=E [A]_Q^E Q^{-1}$$

where $[A]_Q^E$ is the representation of $A$ in the bases from before.

• Can you please recommend an intermediate, rigorous and self-contained text in linear algebra so that I can brush up? – yurnero Mar 27 '15 at 15:40
• @yurnero For a second look at the subject I highly recommend Gilbert Strang's text. – Ian Mar 27 '15 at 15:50
• Thank you. I do have the old Strang text. +1 – yurnero Mar 27 '15 at 15:51

The matrix you constructed does precisely that, but you don't only want $q\ne 0$ (as in $q$ is not the $0$-vector) but you want $q_i \ne 0\ \forall i$ (as in $q$ has no zero entries).

A more compact way to write this would be

$$A = \mathrm{diag}(e \div q)$$ Where $\div$ denotes component-wise division.

Another option is $$A = \frac1{\|q\|_2^2} eq^T = \frac{eq^T}{q^Tq}$$

• Perhaps I'm wrong but if my construction works then it is only needed that one element of $q$ is nonzero, isn't it? – yurnero Mar 27 '15 at 15:43
• +1 because your construction is simpler if every element of $q$ is nonzero. Thanks for your time. – yurnero Mar 27 '15 at 15:56
• @yurnero Actually you can only chose a diagonal matrix $A$ if $q_i = 0 \Rightarrow e_i = 0$ holds. You can then define $0\div 0:= 1$ or any other number. If you have $q_i = 0 \wedge e_i \ne 0$, you can't chose a diagonal matrix $A$. – AlexR Mar 27 '15 at 16:24

I think the simplest thing is to rely on the rank-one (or rank-zero, if one of $e$ or $q$ is zero) matrix $B = e q^T$. This matrix has the following effect on any $n \times 1$ vector $x$:

\begin{align*} Bx = (q \cdot x) e && && && \text{ (you should check this formula!)} \end{align*} where "$\cdot$" is the Euclidean dot product. So, roughly, $B$ outputs $e$ scaled by the extent of $x$ along $q$. In particular, $$B q = (q \cdot q) e.$$ However, we want a matrix $A$ with $Aq=e$. Can you see how to adjust $A$ to get such a matrix? Where does the assumption that $q \neq 0$ enter into this construction?

• Very nice trick. $q\neq 0$ allows us to divide by $q\cdot q$. – yurnero Mar 27 '15 at 16:10
• Yeah, that's right. – Mike F Mar 27 '15 at 16:14