# Solving for unknown 3x3 matrix

Given the following I am trying to solve for $$A$$: $$v_1 = A v_2$$ where $$v_1$$ is a known $$3\times 2$$ matrix, $$A$$ is an unknown $$3\times 3$$ matrix and $$v_2$$ is a known $$3\times 2$$ matrix

$$A^{-1} v_1 = v_2$$

I am not quite sure how to proceed—is there a way to get a solution for A since all of the given vectors are non square? Any leads would be appreciated!

• There's a problem - the matrix product of a $3\times 3$ and a $2\times 3$ in that order doesn't exist. Would you prefer to fix that by reversing the order of multiplication, or by making them $3\times 2$ matrices instead? (Formatting note: \times is the symbol I used there) – jmerry Jan 22 '19 at 4:10
• @jmerry whoops! Fixed to 3 $\times$ 2. – user5826447 Jan 22 '19 at 4:13

Now, the dimensionality says that we should get multiple solutions in general - the problem is finding one. A concept that will get us there? The pseudoinverse. We can't have a full two-sided inverse for the non-square matrix $$v_2$$, so we find a one-sided inverse $$v_2^+$$ so that $$v_2^+v_2 = I_2$$, the $$2\times 2$$ identity. This $$v_2^+$$, of course, will be a $$2\times 3$$ matrix. Then $$A = v_1v_2^+$$ will be a solution: $$(v_1v_2^+)v_2=v_1(v_2^+v_2) = v_1$$.

How do we construct such a matrix? The reference I linked has a bunch of methods, which probably went way over your head. Also, the standard version there has more properties than we need; we're looking for a solution, not the "best" solution. Don't sweat it if we don't end up with exactly the same thing as in the link. So then, let's go elementary. Switch over to the linear transform viewpoint; we have a linear map $$T$$ from a vector space $$U$$ of dimension $$n$$ to another vector space $$W$$ of dimension $$m$$. Choose a basis $$w_1,w_2,\dots$$ for the image of $$T$$ in $$W$$. For each $$w_i$$, choose some $$u_i\in U$$ so that $$T(u_i)=w_i$$. The $$u_i$$ are a linearly independent set in $$U$$. Extend both the $$u_i$$ and the $$w_i$$ to bases of their respective spaces $$U$$ and $$W$$; usually, we will only have to do this for the larger space.
Now, we define $$T^+$$ as follows: for $$i\le \min(m,n)$$, $$T(u_i)=w_i$$. For $$i>\min(m,n)$$, $$T(u_i)$$ can be anything - we don't care, but we'll make them zero just to standardize. Then, since $$(T^+T)w_i = T^+(Tw_i)=T^+u_i=w_i$$ for each $$i\le m$$, $$T^+T$$ is the identity on $$W$$.

All right, back to our setup with $$3\times 2$$ matrices. We have $$m=2 <3=n$$, so we won't have any "extra" vectors to send to zero. There are two length-3 columns of $$v_2$$, which will be our $$w_1$$ and $$w_2$$ (unless they're linearly dependent). What $$u_i$$ can we use to make $$v_2 u_i = w_i$$? Well, the standard basis vectors $$e_1=\begin{pmatrix}1\\0\end{pmatrix}$$ and $$e_2=\begin{pmatrix}0\\1\end{pmatrix}$$ will do the trick. Then $$w_3$$ needs to be something linearly independent from $$w_1$$ and $$w_2$$ - we make an arbitrary choice here. For something easily constructed, take the cross product.
Now, to construct a matrix $$v_2^+$$ with $$v_2^+ w_1=e_1$$, $$v_2^+w_2=e_2$$, $$v_2^+w_3=e_3$$. In matrix form, that's $$v_2^+\begin{pmatrix}w_1&w_2&w_3\end{pmatrix}=\begin{pmatrix}e_1&e_2&0 \end{pmatrix}=\begin{pmatrix}1&0&0\\0&1&0\end{pmatrix}$$ $$v_2^+ = \begin{pmatrix}1&0&0\\0&1&0\end{pmatrix}\begin{pmatrix}w_1&w_2&w_3\end{pmatrix}^{-1}$$ Right-multiplying by that $$2\times 3$$ truncated identity can be summarized simply: throw away the third row.

All right, what if the columns of $$v_2$$ are linearly dependent? The construction is still there, but now only $$w_1$$ is actually in the column space of $$v_2$$. It still satisfies the official pseudoinverse property $$v_2v_2^+v_2=v_2$$, but we no longer have $$v_2^+v_2=I_2$$. As such, we can expect not to get solutions, and we won't unless the column space of $$v_1$$ is contained in the column space of $$v_2$$. If it is, the pseudoinverse construction will give one.

Now, this choice $$A=v_1v_2^+$$ is not invertible - it has rank $$2$$. Can we find an invertible matrix that will also be a solution, and give $$A^{-1}v_2=v_1$$ as well? We'll need to add some $$B$$ such that $$Bv_2=0$$ and $$A+B$$ is invertible. The rows in $$B$$ must be orthogonal to the columns of $$v_2$$, so they'll be multiples of that cross product $$w_3^T$$. In order to make $$A'=A+B$$ invertible, we need to avoid the rows of $$B$$ satisfying the same linear combination as the rows of $$A$$ - just add to the non-pivot row to make this happen. Then $$A'$$ is a solution, and its inverse works on the other side automatically.

Basically the best we can do is: $$A=v_1 v_2^+$$ where $$v_2^+$$ is the Moore-Penrose pseudoinverse.

Note that A will have at most rank 2, although we can make it full rank with an arbitrary vector.

Edit

Alternatively we can solve it with Gaussian elimination. We have: $$v_2^T A^T = v_1^T$$

Let $$A^T=(\mathbf x\ \mathbf y\ \mathbf z)$$ and $$v_1^T=(\mathbf u\ \mathbf v\ \mathbf w)$$. Then we can solve: $$\begin{cases}v_2^T\mathbf x = \mathbf u \\ v_2^T\mathbf y = \mathbf v \\ v_2^T\mathbf z = \mathbf w\end{cases}$$ These are all underdetermined, but any solution will do.

The result will be more or less the same as with the pseudoinverse, just with a classical method.

Assuming $$v_1$$ and $$v_2$$ both have rank $$2$$, take any $$3 \times 1$$ vector $$x_1$$ not in the column space of $$v_1$$, and any vector $$3 \times 1$$ vector $$x_2$$ not in the column space of $$v_2$$; let $$w_1$$ be the $$3 \times 3$$ matrix whose first two columns are $$v_1$$ and third column is $$x_1$$, and let $$w_2$$ be the $$3 \times 3$$ matrix whose first two columns are $$v_2$$ and third column is $$x_2$$. Then $$A = w_1 w_2^{-1}$$ satisfies $$A w_2 = w_1$$ (and thus $$A v_2 = v_1$$ and $$A x_2 = x_1$$), $$A^{-1} w_1 = w_2$$ (and thus $$A^{-1} v_1 = v_2$$ and $$A^{-1} x_1 = x_2$$).