My Math Forum

My Math Forum (http://mymathforum.com/math-forums.php)
-   Linear Algebra (http://mymathforum.com/linear-algebra/)
-   -   Reversing a matrix (http://mymathforum.com/linear-algebra/343774-reversing-matrix.html)

Kevineamon March 28th, 2018 08:36 PM

Reversing a matrix
 
Ok I think this should be easy, if I can explain it properly.

Let's say I had a 2*2 matrix = matrix A
And I was multiplying it 2*1 matrix = matrix B
And it would produce a 2*1 matrix = matrix C
Right?

But let's say - I want to go back ways, reverse it...
I have Matrix C and I have Matrix A but I need to find Matrix B.

I'd better explain this as well, as I'm not sure the rules are exactly the same.

I'm using a nominal Pi model to analyse a transmission line

The layout is like this

Vs | A B | Vr
Is | C D | Ir

Where Vs = A*Vr + B*Ir
And Is = C*Vr + D*Ir

But now I need to find Vr and Ir

I have ABCD and I have Vs and Is

At first I thought well I'll just rearrange the equation to find Vr. But 2 of the variables are missing, when I do that...

Any help would be great guys. Thx

Country Boy March 29th, 2018 05:05 AM

So basically, you want to solve a matrix equation of the form AB= C for B? If A is invertible then $\displaystyle B= A^{-1}C$. If A is not invertible then there is no solution.

Write $\displaystyle A= \begin{bmatrix}a & b \\ c & d \end{bmatrix}$, $\displaystyle B= \begin{bmatrix}x \\ y \end{bmatrix}$, and $\displaystyle C= \begin{bmatrix}p \\ q \end{bmatrix}$. A is invertible if and only if its determinant, ad- bc is not 0 and, in that case, its inverse is $\displaystyle A^{-1}= \frac{1}{ad- bc}\begin{bmatrix}d & -b \\ -c & a\end{bmatrix}$ and $\displaystyle B= A^{-1}C= \frac{1}{ad- bc}\begin{bmatrix}d & -b \\ -c & a\end{bmatrix}\begin{bmatrix}p \\ q \end{bmatrix}= \frac{1}{ad- bc}\begin{bmatrix}dp- bq \\ aq- cp\end{bmatrix}$.

Or you could simply treat the matrix equation as a system of two equations in two unkowns. We have $\displaystyle \begin{bmatrix}a & b \\ c & d \end{bmatrix}\begin{bmatrix}x \\ y \end{bmatrix}= \begin{bmatrix}ax+ by \\ cx+ dy\end{bmatrix}= \begin{bmatrix}p \\ q\end{bmatrix}$.

That is equivalent to the two equations ax+ by= p and cx+ dy= q. Multiply the first equation by d to get adx+ bdy= pd and multiply the second equation by b to get bcx+ bdy= bq. The coefficents of y are now the same, bd, so subtracting one equation from the other eliminates y: (ad- bc)x= pd- bq. If ad- bc is not 0, divide both sides by ad- bc to get $\displaystyle x= \frac{pd- bq}{ad- bc}$ as before. If ad- bc= 0 and pd- bq is not 0, there is no x that makes that equation true. If both ad- bc= 0 and pd- bq= 0 then any x works.

Much the same thing is true of $\displaystyle V_s = AV_r + BI_r$ and $\displaystyle I_s = CV_r + DI_r$. Multiply the first equation by D to get $\displaystyle DV_s= ADV_r+ BDI_r$ and multiply the second equation by B to get $\displaystyle BI_s= BCV_r+ BDI_r$. Now $\displaystyle I_r$ has the same coefficient in both equations so subtracting one equation from the other eliminates $\displaystyle I_r$: $\displaystyle DV_s- BI_s= (AD- BC)V_r$ and $\displaystyle V_r= \frac{DV_s- BI_s}{AD- BC}$, assuming, of course, that AD- BC is non-zero. Then $\displaystyle V_s= AV_r+ BI_r= \frac{ADV_s- ABI_s}{AD- BC}+ BI_r$ so $\displaystyle BI_r= V_s- \frac{ADV_S- ABI_s}{AD- BC}= \frac{ADV_s- BCV_s- ADV_s+ ABI_s}{AD- BC}= \frac{ABI_s- BCV_s}{AD- BC}$.

Micrm@ss March 29th, 2018 06:59 AM

Quote:

Originally Posted by Country Boy (Post 590967)
So basically, you want to solve a matrix equation of the form AB= C for B? If A is invertible then $\displaystyle B= A^{-1}C$. If A is not invertible then there is no solution.

Why wouldn't there be a solution if A is not invertible? Sure, there isn't always a solution for all A and C. But some choices certainly will have (multiple) solutions!

Kevineamon March 29th, 2018 10:14 AM

Beautiful Country Boy. I've written it all out, substituting in numbers on one side, with the equations on the other. I think I understand most of it now.

This bit at the end however, seems to be off by a factor of 2.

Quote:

Originally Posted by Country Boy (Post 590967)
so $\displaystyle BI_r= V_s- \frac{ADV_S- ABI_s}{AD- BC}= \frac{ADV_s- BCV_s- ADV_s+ ABI_s}{AD- BC}= \frac{ABI_s- BCV_s}{AD- BC}$.

I've used:-
$\displaystyle V_s = AV_r + BI_r$
=
$\displaystyle 92 = 12*3 + 14*4$

and

$\displaystyle I_s = CV_r + DI_r$
=
$\displaystyle 85 = 11*3 + 13*4$

Therefore:-

$\displaystyle BI_r = 28 $

But:-

$\displaystyle (ABI_s - BCV_s) / (AD-BC) $

$\displaystyle 112/2 = 56$

Country Boy March 29th, 2018 11:12 AM

Quote:

Originally Posted by Micrm@ss (Post 590975)
Why wouldn't there be a solution if A is not invertible? Sure, there isn't always a solution for all A and C. But some choices certainly will have (multiple) solutions!

Yes, I should have said right at the start that there is not a unique solution. If A is not invertible then either there is no solution or there are an infinite number of solutions. I did later say that "If ad- bc= 0 and pd- bq is not 0, there is no x that makes that equation true. If both ad- bc= 0 and pd- bq= 0 then any x works."

Kevineamon March 29th, 2018 07:06 PM

How about my example Country Boy... Those numbers don't meet any of you conditions. However:-

$\displaystyle BI_r ≠ (ABI_s−BCV_s)/(AD−BC)$

Although it is off by a factor of 2, which is the answer I'm looking for...
Am I supposed to guess something here?
My math is Ok, when I work on it. But it takes a lot of effort. I'm not naturally gifted with it, like your good self. My mathematically intuition = 0 :(
Can you help me take this final step?

SDK March 29th, 2018 09:07 PM

Quote:

Originally Posted by Country Boy (Post 590987)
Yes, I should have said right at the start that there is not a unique solution. If A is not invertible then either there is no solution or there are an infinite number of solutions. I did later say that "If ad- bc= 0 and pd- bq is not 0, there is no x that makes that equation true. If both ad- bc= 0 and pd- bq= 0 then any x works."

This is still not correct. It serves as a good illustration for why the determinant should never enter a discussion about invertibility.

The fact is that if $A$ has full rank, then $AB = C$ may have a unique solution even if $A$ is not invertible. This is easily seen by noticing that $A^TA$ is always invertible where $A^T$ is the conjugate transpose. Now suppose $Ax = b$ where $x,b$ are vectors, then you can easily see that a formula for $x$ is given by
\[x = (A^TA)^{-1} A^T b. \]
In this case, $(A^TA)^{-1}A^T$ is the weak inverse for $A$ which is also a left inverse (sometimes called a pseudo-inverse). Notice that if $A$ is not square, then it doesn't even have a determinant, but that has nothing to do with the question of invertibility.

Kevineamon March 30th, 2018 06:31 AM

While this high brow mathematically discussion is, I can guess... absolutely fascinating. There's a n00b engineer over here with a transmission line to analyse. :rolleyes: Can one of you geniuses, climb down from the lofty tower and explain to lil old me, how to find $\displaystyle I_r$? Please...

Kevineamon March 30th, 2018 06:45 AM

Wait... Inspiration has come... I think...

Kevineamon March 30th, 2018 07:10 AM

$\displaystyle I_r= (CV_s-AI_s)/(CB-AD)$

Well I think your math is great, Country Boy. Never mind the haters. :D


All times are GMT -8. The time now is 11:45 PM.

Copyright © 2019 My Math Forum. All rights reserved.