Is there a closed-form way to make a matrix hollow?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
4
down vote

favorite
2












Let $AinmathbbR^Ntimes N$ a matrix with entries $a_ij ge 0$. I am interested in finding a closed matrix form operation such that $A$ becomes hollow.




In other words, if I want to obtain
$$
tildeAinmathbbR^Ntimes Nquadtextsuch thatquad tildea_ij=a_ij;forall (ineq j)quadtextandquadtildea_ii=0
$$
with constant matrices $P$ and $Q$ such that
$$
tilde A=PAQ
$$
is it possible?




I tried a simple example, when $N=2$ and with brute force I found an interesting correlation with a transformation matrix $Q$ (here $P=I$), but I do not know how (and if) it is generalizable to $N>2$:
$$
A=beginpmatrix
a & b\
c & d
endpmatrix
$$
$$
tildeA=beginpmatrix
0 & b\
c & 0
endpmatrix=PAQ=IAQ=AQ=Acdotfrac1detAbeginpmatrix
-bc & bd\
ac & -bc
endpmatrix
$$



EDIT
From the comments, it has been pointed out that what I seek is not possible, meaning $P$ and $Q$ do not exist. Is there a way to prove this?







share|cite|improve this question

















  • 3




    Your question isn't clear. Are you looking for a formula/function that accepts a matrix and returns the same matrix but with zeros on the main diagonal?
    – GuySa
    Jul 27 at 9:58






  • 1




    @GuySa Yes, exactly
    – Andrea L.
    Jul 27 at 10:19






  • 3




    To zero out the diagonal of $A$ means to subtracting $A$ by $sum_i=1^nE_iiAE_ii$. As $I_n^2-sum_i=1^n(E_iiotimes E_ii)$ is not a Kronecker product, you cannot obtain the zeroed out $A$ by a matrix product of the form $PAQ$ using constant matrices $P$ and $Q$.
    – user1551
    Jul 27 at 10:32







  • 1




    @AndreaL.: If $n>1$ and the matrix $A$ consists of ones everywhere, i.e. $a_ij=1$ for all $i,j$, such $P$ and $Q$ cannot exist, because $operatornamerank(PAQ)leq 1$ (since $operatornamerank(A)=1$) whereas $operatornamerank(widetildeA)>1$.
    – Dejan Govc
    Aug 6 at 23:27







  • 1




    If @user1551 does not post an answer within the bounty period, I will do so after the bounty has expired. However, Andrea, you may be able to figure it out yourself after reading Wikipedia's page on vectorization, paying special attention to the section on compatibility with Kronecker products.
    – Rahul
    2 days ago















up vote
4
down vote

favorite
2












Let $AinmathbbR^Ntimes N$ a matrix with entries $a_ij ge 0$. I am interested in finding a closed matrix form operation such that $A$ becomes hollow.




In other words, if I want to obtain
$$
tildeAinmathbbR^Ntimes Nquadtextsuch thatquad tildea_ij=a_ij;forall (ineq j)quadtextandquadtildea_ii=0
$$
with constant matrices $P$ and $Q$ such that
$$
tilde A=PAQ
$$
is it possible?




I tried a simple example, when $N=2$ and with brute force I found an interesting correlation with a transformation matrix $Q$ (here $P=I$), but I do not know how (and if) it is generalizable to $N>2$:
$$
A=beginpmatrix
a & b\
c & d
endpmatrix
$$
$$
tildeA=beginpmatrix
0 & b\
c & 0
endpmatrix=PAQ=IAQ=AQ=Acdotfrac1detAbeginpmatrix
-bc & bd\
ac & -bc
endpmatrix
$$



EDIT
From the comments, it has been pointed out that what I seek is not possible, meaning $P$ and $Q$ do not exist. Is there a way to prove this?







share|cite|improve this question

















  • 3




    Your question isn't clear. Are you looking for a formula/function that accepts a matrix and returns the same matrix but with zeros on the main diagonal?
    – GuySa
    Jul 27 at 9:58






  • 1




    @GuySa Yes, exactly
    – Andrea L.
    Jul 27 at 10:19






  • 3




    To zero out the diagonal of $A$ means to subtracting $A$ by $sum_i=1^nE_iiAE_ii$. As $I_n^2-sum_i=1^n(E_iiotimes E_ii)$ is not a Kronecker product, you cannot obtain the zeroed out $A$ by a matrix product of the form $PAQ$ using constant matrices $P$ and $Q$.
    – user1551
    Jul 27 at 10:32







  • 1




    @AndreaL.: If $n>1$ and the matrix $A$ consists of ones everywhere, i.e. $a_ij=1$ for all $i,j$, such $P$ and $Q$ cannot exist, because $operatornamerank(PAQ)leq 1$ (since $operatornamerank(A)=1$) whereas $operatornamerank(widetildeA)>1$.
    – Dejan Govc
    Aug 6 at 23:27







  • 1




    If @user1551 does not post an answer within the bounty period, I will do so after the bounty has expired. However, Andrea, you may be able to figure it out yourself after reading Wikipedia's page on vectorization, paying special attention to the section on compatibility with Kronecker products.
    – Rahul
    2 days ago













up vote
4
down vote

favorite
2









up vote
4
down vote

favorite
2






2





Let $AinmathbbR^Ntimes N$ a matrix with entries $a_ij ge 0$. I am interested in finding a closed matrix form operation such that $A$ becomes hollow.




In other words, if I want to obtain
$$
tildeAinmathbbR^Ntimes Nquadtextsuch thatquad tildea_ij=a_ij;forall (ineq j)quadtextandquadtildea_ii=0
$$
with constant matrices $P$ and $Q$ such that
$$
tilde A=PAQ
$$
is it possible?




I tried a simple example, when $N=2$ and with brute force I found an interesting correlation with a transformation matrix $Q$ (here $P=I$), but I do not know how (and if) it is generalizable to $N>2$:
$$
A=beginpmatrix
a & b\
c & d
endpmatrix
$$
$$
tildeA=beginpmatrix
0 & b\
c & 0
endpmatrix=PAQ=IAQ=AQ=Acdotfrac1detAbeginpmatrix
-bc & bd\
ac & -bc
endpmatrix
$$



EDIT
From the comments, it has been pointed out that what I seek is not possible, meaning $P$ and $Q$ do not exist. Is there a way to prove this?







share|cite|improve this question













Let $AinmathbbR^Ntimes N$ a matrix with entries $a_ij ge 0$. I am interested in finding a closed matrix form operation such that $A$ becomes hollow.




In other words, if I want to obtain
$$
tildeAinmathbbR^Ntimes Nquadtextsuch thatquad tildea_ij=a_ij;forall (ineq j)quadtextandquadtildea_ii=0
$$
with constant matrices $P$ and $Q$ such that
$$
tilde A=PAQ
$$
is it possible?




I tried a simple example, when $N=2$ and with brute force I found an interesting correlation with a transformation matrix $Q$ (here $P=I$), but I do not know how (and if) it is generalizable to $N>2$:
$$
A=beginpmatrix
a & b\
c & d
endpmatrix
$$
$$
tildeA=beginpmatrix
0 & b\
c & 0
endpmatrix=PAQ=IAQ=AQ=Acdotfrac1detAbeginpmatrix
-bc & bd\
ac & -bc
endpmatrix
$$



EDIT
From the comments, it has been pointed out that what I seek is not possible, meaning $P$ and $Q$ do not exist. Is there a way to prove this?









share|cite|improve this question












share|cite|improve this question




share|cite|improve this question








edited Aug 3 at 10:09
























asked Jul 27 at 8:27









Andrea L.

361514




361514







  • 3




    Your question isn't clear. Are you looking for a formula/function that accepts a matrix and returns the same matrix but with zeros on the main diagonal?
    – GuySa
    Jul 27 at 9:58






  • 1




    @GuySa Yes, exactly
    – Andrea L.
    Jul 27 at 10:19






  • 3




    To zero out the diagonal of $A$ means to subtracting $A$ by $sum_i=1^nE_iiAE_ii$. As $I_n^2-sum_i=1^n(E_iiotimes E_ii)$ is not a Kronecker product, you cannot obtain the zeroed out $A$ by a matrix product of the form $PAQ$ using constant matrices $P$ and $Q$.
    – user1551
    Jul 27 at 10:32







  • 1




    @AndreaL.: If $n>1$ and the matrix $A$ consists of ones everywhere, i.e. $a_ij=1$ for all $i,j$, such $P$ and $Q$ cannot exist, because $operatornamerank(PAQ)leq 1$ (since $operatornamerank(A)=1$) whereas $operatornamerank(widetildeA)>1$.
    – Dejan Govc
    Aug 6 at 23:27







  • 1




    If @user1551 does not post an answer within the bounty period, I will do so after the bounty has expired. However, Andrea, you may be able to figure it out yourself after reading Wikipedia's page on vectorization, paying special attention to the section on compatibility with Kronecker products.
    – Rahul
    2 days ago













  • 3




    Your question isn't clear. Are you looking for a formula/function that accepts a matrix and returns the same matrix but with zeros on the main diagonal?
    – GuySa
    Jul 27 at 9:58






  • 1




    @GuySa Yes, exactly
    – Andrea L.
    Jul 27 at 10:19






  • 3




    To zero out the diagonal of $A$ means to subtracting $A$ by $sum_i=1^nE_iiAE_ii$. As $I_n^2-sum_i=1^n(E_iiotimes E_ii)$ is not a Kronecker product, you cannot obtain the zeroed out $A$ by a matrix product of the form $PAQ$ using constant matrices $P$ and $Q$.
    – user1551
    Jul 27 at 10:32







  • 1




    @AndreaL.: If $n>1$ and the matrix $A$ consists of ones everywhere, i.e. $a_ij=1$ for all $i,j$, such $P$ and $Q$ cannot exist, because $operatornamerank(PAQ)leq 1$ (since $operatornamerank(A)=1$) whereas $operatornamerank(widetildeA)>1$.
    – Dejan Govc
    Aug 6 at 23:27







  • 1




    If @user1551 does not post an answer within the bounty period, I will do so after the bounty has expired. However, Andrea, you may be able to figure it out yourself after reading Wikipedia's page on vectorization, paying special attention to the section on compatibility with Kronecker products.
    – Rahul
    2 days ago








3




3




Your question isn't clear. Are you looking for a formula/function that accepts a matrix and returns the same matrix but with zeros on the main diagonal?
– GuySa
Jul 27 at 9:58




Your question isn't clear. Are you looking for a formula/function that accepts a matrix and returns the same matrix but with zeros on the main diagonal?
– GuySa
Jul 27 at 9:58




1




1




@GuySa Yes, exactly
– Andrea L.
Jul 27 at 10:19




@GuySa Yes, exactly
– Andrea L.
Jul 27 at 10:19




3




3




To zero out the diagonal of $A$ means to subtracting $A$ by $sum_i=1^nE_iiAE_ii$. As $I_n^2-sum_i=1^n(E_iiotimes E_ii)$ is not a Kronecker product, you cannot obtain the zeroed out $A$ by a matrix product of the form $PAQ$ using constant matrices $P$ and $Q$.
– user1551
Jul 27 at 10:32





To zero out the diagonal of $A$ means to subtracting $A$ by $sum_i=1^nE_iiAE_ii$. As $I_n^2-sum_i=1^n(E_iiotimes E_ii)$ is not a Kronecker product, you cannot obtain the zeroed out $A$ by a matrix product of the form $PAQ$ using constant matrices $P$ and $Q$.
– user1551
Jul 27 at 10:32





1




1




@AndreaL.: If $n>1$ and the matrix $A$ consists of ones everywhere, i.e. $a_ij=1$ for all $i,j$, such $P$ and $Q$ cannot exist, because $operatornamerank(PAQ)leq 1$ (since $operatornamerank(A)=1$) whereas $operatornamerank(widetildeA)>1$.
– Dejan Govc
Aug 6 at 23:27





@AndreaL.: If $n>1$ and the matrix $A$ consists of ones everywhere, i.e. $a_ij=1$ for all $i,j$, such $P$ and $Q$ cannot exist, because $operatornamerank(PAQ)leq 1$ (since $operatornamerank(A)=1$) whereas $operatornamerank(widetildeA)>1$.
– Dejan Govc
Aug 6 at 23:27





1




1




If @user1551 does not post an answer within the bounty period, I will do so after the bounty has expired. However, Andrea, you may be able to figure it out yourself after reading Wikipedia's page on vectorization, paying special attention to the section on compatibility with Kronecker products.
– Rahul
2 days ago





If @user1551 does not post an answer within the bounty period, I will do so after the bounty has expired. However, Andrea, you may be able to figure it out yourself after reading Wikipedia's page on vectorization, paying special attention to the section on compatibility with Kronecker products.
– Rahul
2 days ago











1 Answer
1






active

oldest

votes

















up vote
2
down vote



+25










If I understand the question, you would like to have $$Pbeginbmatrix1&1\1&1endbmatrixQ=beginbmatrix0&1\1&0endbmatrix$$
This is not possible, since the left side has determinant $0$, and the right side has determinant $-1$.



With $N>2$, the story is the same using a matrix of all $1$s, which we can denote $mathbf1$. In that case, you want $$Pmathbf1Q=mathbf1-I$$ The left side has determinant $0$. As for the right side, note that $$(mathbf1-I)left(frac1N-1mathbf1-Iright)=fracNN-1mathbf1-mathbf1-frac1N-1mathbf1+I=I$$ so the right side is invertible, and has nonzero determinant.






share|cite|improve this answer





















    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',
    convertImagesToLinks: true,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    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%2f2864180%2fis-there-a-closed-form-way-to-make-a-matrix-hollow%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote



    +25










    If I understand the question, you would like to have $$Pbeginbmatrix1&1\1&1endbmatrixQ=beginbmatrix0&1\1&0endbmatrix$$
    This is not possible, since the left side has determinant $0$, and the right side has determinant $-1$.



    With $N>2$, the story is the same using a matrix of all $1$s, which we can denote $mathbf1$. In that case, you want $$Pmathbf1Q=mathbf1-I$$ The left side has determinant $0$. As for the right side, note that $$(mathbf1-I)left(frac1N-1mathbf1-Iright)=fracNN-1mathbf1-mathbf1-frac1N-1mathbf1+I=I$$ so the right side is invertible, and has nonzero determinant.






    share|cite|improve this answer

























      up vote
      2
      down vote



      +25










      If I understand the question, you would like to have $$Pbeginbmatrix1&1\1&1endbmatrixQ=beginbmatrix0&1\1&0endbmatrix$$
      This is not possible, since the left side has determinant $0$, and the right side has determinant $-1$.



      With $N>2$, the story is the same using a matrix of all $1$s, which we can denote $mathbf1$. In that case, you want $$Pmathbf1Q=mathbf1-I$$ The left side has determinant $0$. As for the right side, note that $$(mathbf1-I)left(frac1N-1mathbf1-Iright)=fracNN-1mathbf1-mathbf1-frac1N-1mathbf1+I=I$$ so the right side is invertible, and has nonzero determinant.






      share|cite|improve this answer























        up vote
        2
        down vote



        +25







        up vote
        2
        down vote



        +25




        +25




        If I understand the question, you would like to have $$Pbeginbmatrix1&1\1&1endbmatrixQ=beginbmatrix0&1\1&0endbmatrix$$
        This is not possible, since the left side has determinant $0$, and the right side has determinant $-1$.



        With $N>2$, the story is the same using a matrix of all $1$s, which we can denote $mathbf1$. In that case, you want $$Pmathbf1Q=mathbf1-I$$ The left side has determinant $0$. As for the right side, note that $$(mathbf1-I)left(frac1N-1mathbf1-Iright)=fracNN-1mathbf1-mathbf1-frac1N-1mathbf1+I=I$$ so the right side is invertible, and has nonzero determinant.






        share|cite|improve this answer













        If I understand the question, you would like to have $$Pbeginbmatrix1&1\1&1endbmatrixQ=beginbmatrix0&1\1&0endbmatrix$$
        This is not possible, since the left side has determinant $0$, and the right side has determinant $-1$.



        With $N>2$, the story is the same using a matrix of all $1$s, which we can denote $mathbf1$. In that case, you want $$Pmathbf1Q=mathbf1-I$$ The left side has determinant $0$. As for the right side, note that $$(mathbf1-I)left(frac1N-1mathbf1-Iright)=fracNN-1mathbf1-mathbf1-frac1N-1mathbf1+I=I$$ so the right side is invertible, and has nonzero determinant.







        share|cite|improve this answer













        share|cite|improve this answer



        share|cite|improve this answer











        answered yesterday









        alex.jordan

        36.9k459117




        36.9k459117






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2864180%2fis-there-a-closed-form-way-to-make-a-matrix-hollow%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            What is the equation of a 3D cone with generalised tilt?

            Color the edges and diagonals of a regular polygon

            Relationship between determinant of matrix and determinant of adjoint?