Trouble to find the solution to a linear system where a matrix is not invertible












1












$begingroup$


Hello community I am new here and I have a question which might be pretty basic.



So I am trying to solve an equation. I have 3 matrices



A = begin{pmatrix}1&0&0&0&0&0&0&0\0&1&1&0&0&0&0&0end{pmatrix}



B = begin{pmatrix}0&0&0&0&0&0&1&0\0&0&0&0&0&0&0&1end{pmatrix}



and
K = begin{pmatrix}1&0&0&0&0&0&0&0\0&1&1&0&0&0&0&0\0&0&0&0&0&0&1&0end{pmatrix}



H = begin{pmatrix}A\Bend{pmatrix}



and Z = begin{pmatrix}z1\z2\z3end{pmatrix}



And I have linear system



$begin{pmatrix}H\Kend{pmatrix} v = begin{pmatrix}0\Zend{pmatrix}$



It says that solution for determined system is



$ v = begin{bmatrix}begin{pmatrix}H\Kend{pmatrix}^T begin{pmatrix}H\Kend{pmatrix} end{bmatrix} ^{-1}begin{pmatrix}H\Kend{pmatrix}^T begin{pmatrix}0\Zend{pmatrix} $



Okay when I put this system of matrices in python it shows that matrix inside can't be inverse. I am presumping that



H = begin{pmatrix}A\Bend{pmatrix}
just means that



H is



begin{pmatrix}1&0&0&0&0&0&0&0\0&1&1&0&0&0&0&0\0&0&0&0&0&0&1&0\0&0&0&0&0&0&0&1end{pmatrix}



Two matrices put together. Same I presume for begin{pmatrix}H\Kend{pmatrix}



Where am I wrong?



Ps: sorry im new here hope I wrote everything correctly and understandable. Happy holidays everyone.










share|cite|improve this question











$endgroup$












  • $begingroup$
    I have taken the liberty to make your title less interchangeable with another one
    $endgroup$
    – Jean Marie
    Dec 13 '18 at 13:28
















1












$begingroup$


Hello community I am new here and I have a question which might be pretty basic.



So I am trying to solve an equation. I have 3 matrices



A = begin{pmatrix}1&0&0&0&0&0&0&0\0&1&1&0&0&0&0&0end{pmatrix}



B = begin{pmatrix}0&0&0&0&0&0&1&0\0&0&0&0&0&0&0&1end{pmatrix}



and
K = begin{pmatrix}1&0&0&0&0&0&0&0\0&1&1&0&0&0&0&0\0&0&0&0&0&0&1&0end{pmatrix}



H = begin{pmatrix}A\Bend{pmatrix}



and Z = begin{pmatrix}z1\z2\z3end{pmatrix}



And I have linear system



$begin{pmatrix}H\Kend{pmatrix} v = begin{pmatrix}0\Zend{pmatrix}$



It says that solution for determined system is



$ v = begin{bmatrix}begin{pmatrix}H\Kend{pmatrix}^T begin{pmatrix}H\Kend{pmatrix} end{bmatrix} ^{-1}begin{pmatrix}H\Kend{pmatrix}^T begin{pmatrix}0\Zend{pmatrix} $



Okay when I put this system of matrices in python it shows that matrix inside can't be inverse. I am presumping that



H = begin{pmatrix}A\Bend{pmatrix}
just means that



H is



begin{pmatrix}1&0&0&0&0&0&0&0\0&1&1&0&0&0&0&0\0&0&0&0&0&0&1&0\0&0&0&0&0&0&0&1end{pmatrix}



Two matrices put together. Same I presume for begin{pmatrix}H\Kend{pmatrix}



Where am I wrong?



Ps: sorry im new here hope I wrote everything correctly and understandable. Happy holidays everyone.










share|cite|improve this question











$endgroup$












  • $begingroup$
    I have taken the liberty to make your title less interchangeable with another one
    $endgroup$
    – Jean Marie
    Dec 13 '18 at 13:28














1












1








1





$begingroup$


Hello community I am new here and I have a question which might be pretty basic.



So I am trying to solve an equation. I have 3 matrices



A = begin{pmatrix}1&0&0&0&0&0&0&0\0&1&1&0&0&0&0&0end{pmatrix}



B = begin{pmatrix}0&0&0&0&0&0&1&0\0&0&0&0&0&0&0&1end{pmatrix}



and
K = begin{pmatrix}1&0&0&0&0&0&0&0\0&1&1&0&0&0&0&0\0&0&0&0&0&0&1&0end{pmatrix}



H = begin{pmatrix}A\Bend{pmatrix}



and Z = begin{pmatrix}z1\z2\z3end{pmatrix}



And I have linear system



$begin{pmatrix}H\Kend{pmatrix} v = begin{pmatrix}0\Zend{pmatrix}$



It says that solution for determined system is



$ v = begin{bmatrix}begin{pmatrix}H\Kend{pmatrix}^T begin{pmatrix}H\Kend{pmatrix} end{bmatrix} ^{-1}begin{pmatrix}H\Kend{pmatrix}^T begin{pmatrix}0\Zend{pmatrix} $



Okay when I put this system of matrices in python it shows that matrix inside can't be inverse. I am presumping that



H = begin{pmatrix}A\Bend{pmatrix}
just means that



H is



begin{pmatrix}1&0&0&0&0&0&0&0\0&1&1&0&0&0&0&0\0&0&0&0&0&0&1&0\0&0&0&0&0&0&0&1end{pmatrix}



Two matrices put together. Same I presume for begin{pmatrix}H\Kend{pmatrix}



Where am I wrong?



Ps: sorry im new here hope I wrote everything correctly and understandable. Happy holidays everyone.










share|cite|improve this question











$endgroup$




Hello community I am new here and I have a question which might be pretty basic.



So I am trying to solve an equation. I have 3 matrices



A = begin{pmatrix}1&0&0&0&0&0&0&0\0&1&1&0&0&0&0&0end{pmatrix}



B = begin{pmatrix}0&0&0&0&0&0&1&0\0&0&0&0&0&0&0&1end{pmatrix}



and
K = begin{pmatrix}1&0&0&0&0&0&0&0\0&1&1&0&0&0&0&0\0&0&0&0&0&0&1&0end{pmatrix}



H = begin{pmatrix}A\Bend{pmatrix}



and Z = begin{pmatrix}z1\z2\z3end{pmatrix}



And I have linear system



$begin{pmatrix}H\Kend{pmatrix} v = begin{pmatrix}0\Zend{pmatrix}$



It says that solution for determined system is



$ v = begin{bmatrix}begin{pmatrix}H\Kend{pmatrix}^T begin{pmatrix}H\Kend{pmatrix} end{bmatrix} ^{-1}begin{pmatrix}H\Kend{pmatrix}^T begin{pmatrix}0\Zend{pmatrix} $



Okay when I put this system of matrices in python it shows that matrix inside can't be inverse. I am presumping that



H = begin{pmatrix}A\Bend{pmatrix}
just means that



H is



begin{pmatrix}1&0&0&0&0&0&0&0\0&1&1&0&0&0&0&0\0&0&0&0&0&0&1&0\0&0&0&0&0&0&0&1end{pmatrix}



Two matrices put together. Same I presume for begin{pmatrix}H\Kend{pmatrix}



Where am I wrong?



Ps: sorry im new here hope I wrote everything correctly and understandable. Happy holidays everyone.







matrices






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Dec 13 '18 at 13:26









Jean Marie

30.3k42051




30.3k42051










asked Dec 13 '18 at 8:36









Noob ProgrammerNoob Programmer

103




103












  • $begingroup$
    I have taken the liberty to make your title less interchangeable with another one
    $endgroup$
    – Jean Marie
    Dec 13 '18 at 13:28


















  • $begingroup$
    I have taken the liberty to make your title less interchangeable with another one
    $endgroup$
    – Jean Marie
    Dec 13 '18 at 13:28
















$begingroup$
I have taken the liberty to make your title less interchangeable with another one
$endgroup$
– Jean Marie
Dec 13 '18 at 13:28




$begingroup$
I have taken the liberty to make your title less interchangeable with another one
$endgroup$
– Jean Marie
Dec 13 '18 at 13:28










1 Answer
1






active

oldest

votes


















0












$begingroup$

For the sake of simpler notations, let us rename $$L:=begin{pmatrix}H\Kend{pmatrix} text{and} P:=begin{pmatrix}0\Zend{pmatrix} $$



giving :



$$Lv=P tag{1}$$



which is a $7 times 8$ system (thus an underdetermined system : less constraints than the number of unknowns).



Instead of your $$ v = (L^T L)^{-1}L^T P $$



which is a formula valid for overdetermined systems, one must take for an underdetermined system :



$$ v = L^T(L L^T)^{-1} P tag{2}$$



(see https://see.stanford.edu/materials/lsoeldsee263/08-min-norm.pdf for the difference of formulas between under- and over-determined systems ; in this document, a matrix like $L$ with more columns than lines is called "fat").



This will give you a so-called "mean-squares" solution.



Proof of (1) : Plug (2) into (1), you will get :



$$underbrace{L L^T(L L^T)^{-1}}_{text{identity matrix} I} P=P...$$






share|cite|improve this answer











$endgroup$













  • $begingroup$
    Thank you so much for the time and effort. I tried your way and indeed i got a solution, but i think its the wrong one. since i still get that v4 = 0 whiere it should be v4 = v5 = 1/3(vz1+vz3 -vz2). This is just an example of the error, there are more of them. And I have another question. How do I know if its pseudo-inverse, where it doesn't say in the exercise?
    $endgroup$
    – Noob Programmer
    Dec 13 '18 at 10:22












  • $begingroup$
    Did you notice that I have completely re-written my answer. I had made a mistake (I had sticked to your formula which is not the right one). In particular, I do not use any more the pseudo inverse. Besides, I am going to add a proof for the formula I gave.
    $endgroup$
    – Jean Marie
    Dec 13 '18 at 10:33












  • $begingroup$
    Sorry didn't notice, didn't refresh my page. Thank you for your effort. It solved my problem :)
    $endgroup$
    – Noob Programmer
    Dec 13 '18 at 10:47










  • $begingroup$
    I have added a reference.
    $endgroup$
    – Jean Marie
    Dec 13 '18 at 13:23











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3037758%2ftrouble-to-find-the-solution-to-a-linear-system-where-a-matrix-is-not-invertible%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0












$begingroup$

For the sake of simpler notations, let us rename $$L:=begin{pmatrix}H\Kend{pmatrix} text{and} P:=begin{pmatrix}0\Zend{pmatrix} $$



giving :



$$Lv=P tag{1}$$



which is a $7 times 8$ system (thus an underdetermined system : less constraints than the number of unknowns).



Instead of your $$ v = (L^T L)^{-1}L^T P $$



which is a formula valid for overdetermined systems, one must take for an underdetermined system :



$$ v = L^T(L L^T)^{-1} P tag{2}$$



(see https://see.stanford.edu/materials/lsoeldsee263/08-min-norm.pdf for the difference of formulas between under- and over-determined systems ; in this document, a matrix like $L$ with more columns than lines is called "fat").



This will give you a so-called "mean-squares" solution.



Proof of (1) : Plug (2) into (1), you will get :



$$underbrace{L L^T(L L^T)^{-1}}_{text{identity matrix} I} P=P...$$






share|cite|improve this answer











$endgroup$













  • $begingroup$
    Thank you so much for the time and effort. I tried your way and indeed i got a solution, but i think its the wrong one. since i still get that v4 = 0 whiere it should be v4 = v5 = 1/3(vz1+vz3 -vz2). This is just an example of the error, there are more of them. And I have another question. How do I know if its pseudo-inverse, where it doesn't say in the exercise?
    $endgroup$
    – Noob Programmer
    Dec 13 '18 at 10:22












  • $begingroup$
    Did you notice that I have completely re-written my answer. I had made a mistake (I had sticked to your formula which is not the right one). In particular, I do not use any more the pseudo inverse. Besides, I am going to add a proof for the formula I gave.
    $endgroup$
    – Jean Marie
    Dec 13 '18 at 10:33












  • $begingroup$
    Sorry didn't notice, didn't refresh my page. Thank you for your effort. It solved my problem :)
    $endgroup$
    – Noob Programmer
    Dec 13 '18 at 10:47










  • $begingroup$
    I have added a reference.
    $endgroup$
    – Jean Marie
    Dec 13 '18 at 13:23
















0












$begingroup$

For the sake of simpler notations, let us rename $$L:=begin{pmatrix}H\Kend{pmatrix} text{and} P:=begin{pmatrix}0\Zend{pmatrix} $$



giving :



$$Lv=P tag{1}$$



which is a $7 times 8$ system (thus an underdetermined system : less constraints than the number of unknowns).



Instead of your $$ v = (L^T L)^{-1}L^T P $$



which is a formula valid for overdetermined systems, one must take for an underdetermined system :



$$ v = L^T(L L^T)^{-1} P tag{2}$$



(see https://see.stanford.edu/materials/lsoeldsee263/08-min-norm.pdf for the difference of formulas between under- and over-determined systems ; in this document, a matrix like $L$ with more columns than lines is called "fat").



This will give you a so-called "mean-squares" solution.



Proof of (1) : Plug (2) into (1), you will get :



$$underbrace{L L^T(L L^T)^{-1}}_{text{identity matrix} I} P=P...$$






share|cite|improve this answer











$endgroup$













  • $begingroup$
    Thank you so much for the time and effort. I tried your way and indeed i got a solution, but i think its the wrong one. since i still get that v4 = 0 whiere it should be v4 = v5 = 1/3(vz1+vz3 -vz2). This is just an example of the error, there are more of them. And I have another question. How do I know if its pseudo-inverse, where it doesn't say in the exercise?
    $endgroup$
    – Noob Programmer
    Dec 13 '18 at 10:22












  • $begingroup$
    Did you notice that I have completely re-written my answer. I had made a mistake (I had sticked to your formula which is not the right one). In particular, I do not use any more the pseudo inverse. Besides, I am going to add a proof for the formula I gave.
    $endgroup$
    – Jean Marie
    Dec 13 '18 at 10:33












  • $begingroup$
    Sorry didn't notice, didn't refresh my page. Thank you for your effort. It solved my problem :)
    $endgroup$
    – Noob Programmer
    Dec 13 '18 at 10:47










  • $begingroup$
    I have added a reference.
    $endgroup$
    – Jean Marie
    Dec 13 '18 at 13:23














0












0








0





$begingroup$

For the sake of simpler notations, let us rename $$L:=begin{pmatrix}H\Kend{pmatrix} text{and} P:=begin{pmatrix}0\Zend{pmatrix} $$



giving :



$$Lv=P tag{1}$$



which is a $7 times 8$ system (thus an underdetermined system : less constraints than the number of unknowns).



Instead of your $$ v = (L^T L)^{-1}L^T P $$



which is a formula valid for overdetermined systems, one must take for an underdetermined system :



$$ v = L^T(L L^T)^{-1} P tag{2}$$



(see https://see.stanford.edu/materials/lsoeldsee263/08-min-norm.pdf for the difference of formulas between under- and over-determined systems ; in this document, a matrix like $L$ with more columns than lines is called "fat").



This will give you a so-called "mean-squares" solution.



Proof of (1) : Plug (2) into (1), you will get :



$$underbrace{L L^T(L L^T)^{-1}}_{text{identity matrix} I} P=P...$$






share|cite|improve this answer











$endgroup$



For the sake of simpler notations, let us rename $$L:=begin{pmatrix}H\Kend{pmatrix} text{and} P:=begin{pmatrix}0\Zend{pmatrix} $$



giving :



$$Lv=P tag{1}$$



which is a $7 times 8$ system (thus an underdetermined system : less constraints than the number of unknowns).



Instead of your $$ v = (L^T L)^{-1}L^T P $$



which is a formula valid for overdetermined systems, one must take for an underdetermined system :



$$ v = L^T(L L^T)^{-1} P tag{2}$$



(see https://see.stanford.edu/materials/lsoeldsee263/08-min-norm.pdf for the difference of formulas between under- and over-determined systems ; in this document, a matrix like $L$ with more columns than lines is called "fat").



This will give you a so-called "mean-squares" solution.



Proof of (1) : Plug (2) into (1), you will get :



$$underbrace{L L^T(L L^T)^{-1}}_{text{identity matrix} I} P=P...$$







share|cite|improve this answer














share|cite|improve this answer



share|cite|improve this answer








edited Dec 13 '18 at 13:22

























answered Dec 13 '18 at 8:59









Jean MarieJean Marie

30.3k42051




30.3k42051












  • $begingroup$
    Thank you so much for the time and effort. I tried your way and indeed i got a solution, but i think its the wrong one. since i still get that v4 = 0 whiere it should be v4 = v5 = 1/3(vz1+vz3 -vz2). This is just an example of the error, there are more of them. And I have another question. How do I know if its pseudo-inverse, where it doesn't say in the exercise?
    $endgroup$
    – Noob Programmer
    Dec 13 '18 at 10:22












  • $begingroup$
    Did you notice that I have completely re-written my answer. I had made a mistake (I had sticked to your formula which is not the right one). In particular, I do not use any more the pseudo inverse. Besides, I am going to add a proof for the formula I gave.
    $endgroup$
    – Jean Marie
    Dec 13 '18 at 10:33












  • $begingroup$
    Sorry didn't notice, didn't refresh my page. Thank you for your effort. It solved my problem :)
    $endgroup$
    – Noob Programmer
    Dec 13 '18 at 10:47










  • $begingroup$
    I have added a reference.
    $endgroup$
    – Jean Marie
    Dec 13 '18 at 13:23


















  • $begingroup$
    Thank you so much for the time and effort. I tried your way and indeed i got a solution, but i think its the wrong one. since i still get that v4 = 0 whiere it should be v4 = v5 = 1/3(vz1+vz3 -vz2). This is just an example of the error, there are more of them. And I have another question. How do I know if its pseudo-inverse, where it doesn't say in the exercise?
    $endgroup$
    – Noob Programmer
    Dec 13 '18 at 10:22












  • $begingroup$
    Did you notice that I have completely re-written my answer. I had made a mistake (I had sticked to your formula which is not the right one). In particular, I do not use any more the pseudo inverse. Besides, I am going to add a proof for the formula I gave.
    $endgroup$
    – Jean Marie
    Dec 13 '18 at 10:33












  • $begingroup$
    Sorry didn't notice, didn't refresh my page. Thank you for your effort. It solved my problem :)
    $endgroup$
    – Noob Programmer
    Dec 13 '18 at 10:47










  • $begingroup$
    I have added a reference.
    $endgroup$
    – Jean Marie
    Dec 13 '18 at 13:23
















$begingroup$
Thank you so much for the time and effort. I tried your way and indeed i got a solution, but i think its the wrong one. since i still get that v4 = 0 whiere it should be v4 = v5 = 1/3(vz1+vz3 -vz2). This is just an example of the error, there are more of them. And I have another question. How do I know if its pseudo-inverse, where it doesn't say in the exercise?
$endgroup$
– Noob Programmer
Dec 13 '18 at 10:22






$begingroup$
Thank you so much for the time and effort. I tried your way and indeed i got a solution, but i think its the wrong one. since i still get that v4 = 0 whiere it should be v4 = v5 = 1/3(vz1+vz3 -vz2). This is just an example of the error, there are more of them. And I have another question. How do I know if its pseudo-inverse, where it doesn't say in the exercise?
$endgroup$
– Noob Programmer
Dec 13 '18 at 10:22














$begingroup$
Did you notice that I have completely re-written my answer. I had made a mistake (I had sticked to your formula which is not the right one). In particular, I do not use any more the pseudo inverse. Besides, I am going to add a proof for the formula I gave.
$endgroup$
– Jean Marie
Dec 13 '18 at 10:33






$begingroup$
Did you notice that I have completely re-written my answer. I had made a mistake (I had sticked to your formula which is not the right one). In particular, I do not use any more the pseudo inverse. Besides, I am going to add a proof for the formula I gave.
$endgroup$
– Jean Marie
Dec 13 '18 at 10:33














$begingroup$
Sorry didn't notice, didn't refresh my page. Thank you for your effort. It solved my problem :)
$endgroup$
– Noob Programmer
Dec 13 '18 at 10:47




$begingroup$
Sorry didn't notice, didn't refresh my page. Thank you for your effort. It solved my problem :)
$endgroup$
– Noob Programmer
Dec 13 '18 at 10:47












$begingroup$
I have added a reference.
$endgroup$
– Jean Marie
Dec 13 '18 at 13:23




$begingroup$
I have added a reference.
$endgroup$
– Jean Marie
Dec 13 '18 at 13:23


















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3037758%2ftrouble-to-find-the-solution-to-a-linear-system-where-a-matrix-is-not-invertible%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Le Mesnil-Réaume

Ida-Boy-Ed-Garten

web3.py web3.isConnected() returns false always