My Math Forum Reversing a matrix

 Linear Algebra Linear Algebra Math Forum

 March 28th, 2018, 08:36 PM #1 Member   Joined: Nov 2016 From: Ireland Posts: 84 Thanks: 3 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
 March 29th, 2018, 05:05 AM #2 Math Team   Joined: Jan 2015 From: Alabama Posts: 3,264 Thanks: 902 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}$. Thanks from Kevineamon
March 29th, 2018, 06:59 AM   #3
Senior Member

Joined: Oct 2009

Posts: 784
Thanks: 280

Quote:
 Originally Posted by Country Boy 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!

March 29th, 2018, 10:14 AM   #4
Member

Joined: Nov 2016
From: Ireland

Posts: 84
Thanks: 3

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 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$

Last edited by Kevineamon; March 29th, 2018 at 10:21 AM.

March 29th, 2018, 11:12 AM   #5
Math Team

Joined: Jan 2015
From: Alabama

Posts: 3,264
Thanks: 902

Quote:
 Originally Posted by Micrm@ss 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."

 March 29th, 2018, 07:06 PM #6 Member   Joined: Nov 2016 From: Ireland Posts: 84 Thanks: 3 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?
March 29th, 2018, 09:07 PM   #7
Senior Member

Joined: Sep 2016
From: USA

Posts: 609
Thanks: 378

Math Focus: Dynamical systems, analytic function theory, numerics
Quote:
 Originally Posted by Country Boy 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.

 March 30th, 2018, 06:31 AM #8 Member   Joined: Nov 2016 From: Ireland Posts: 84 Thanks: 3 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. Can one of you geniuses, climb down from the lofty tower and explain to lil old me, how to find $\displaystyle I_r$? Please...
 March 30th, 2018, 06:45 AM #9 Member   Joined: Nov 2016 From: Ireland Posts: 84 Thanks: 3 Wait... Inspiration has come... I think...
 March 30th, 2018, 07:10 AM #10 Member   Joined: Nov 2016 From: Ireland Posts: 84 Thanks: 3 $\displaystyle I_r= (CV_s-AI_s)/(CB-AD)$ Well I think your math is great, Country Boy. Never mind the haters.

 Tags matrix, reversing

 Thread Tools Display Modes Linear Mode

 Similar Threads Thread Thread Starter Forum Replies Last Post Vidofner Applied Math 4 January 12th, 2014 08:47 AM oneup Elementary Math 4 September 2nd, 2013 04:08 AM Liqwde Computer Science 2 August 31st, 2010 08:59 PM OSearcy4 Calculus 4 October 17th, 2009 03:32 PM Cat Number Theory 6 January 7th, 2007 07:32 PM

 Contact - Home - Forums - Cryptocurrency Forum - Top