Where can you put parenthesis inside of matrix multiplication expressions? Does it change if you have a...












1












$begingroup$


I have taken a linear algebra course however now that I have a project involving it I find myself extremely confused by two things. You see the class taught me that AB is not the same as BA but what it didnt help me out with is the ordering.



Yes, I can write out a list of what I need to do to a point but I am confused by which matrix goes on the left or the right. For example if I wanted to take a vector v in a screen space, scale it with matrix S then rotate it with matrix R then translate it with matrix X would the correct operation be v * S * R * X or (S * R * X) * v or S * R * X * v furthermore what is the ordering of these multiplications?



To calculate v * S * R * X can I do it like this (((v * S) * R) * X) or would it need to be like this (v * (S * (R * X))) or something completely different like v * (S * (R * X)) which of these are even equivalent? How do I know?



On top of that confusion I am wondering if a certain property holds however I am having the hardest time testing it because I am not certain about all the ordering/steps stuff above.



Is (S * R * X)^-1 the same as S^-1 * R^-1 * X^-1 or X^-1 * R^-1 * X^-1 or none of the above? You can see how determining this would be difficult without firm footing on the steps.



Could you please help me clear up which above statements are correct and how I can put parenthesis in these statements without changing the meaning and whether the vector gets multiplied on the left or the right? Additionally does that inverse property hold at all?



If it helps I am working with 3x3 matrices exclusively. Technically I am transforming 2D points with 2D transformations however I have to extend my point to a vector (p.x, p.y, 1) in order to be able to do the transform calculations.










share|cite|improve this question









$endgroup$












  • $begingroup$
    Fortunately, matrix multiplication is associative, so as long as you don't change the order, adding parentheses or not won't change the result.
    $endgroup$
    – Rylee Lyman
    Jan 28 at 3:03










  • $begingroup$
    So based on that v * (S * R * X) would be different than (S * R * X) * v why is this though? If I assume that (S * R * X) results in a matrix that does transformation T.
    $endgroup$
    – J.Doe
    Jan 28 at 3:06
















1












$begingroup$


I have taken a linear algebra course however now that I have a project involving it I find myself extremely confused by two things. You see the class taught me that AB is not the same as BA but what it didnt help me out with is the ordering.



Yes, I can write out a list of what I need to do to a point but I am confused by which matrix goes on the left or the right. For example if I wanted to take a vector v in a screen space, scale it with matrix S then rotate it with matrix R then translate it with matrix X would the correct operation be v * S * R * X or (S * R * X) * v or S * R * X * v furthermore what is the ordering of these multiplications?



To calculate v * S * R * X can I do it like this (((v * S) * R) * X) or would it need to be like this (v * (S * (R * X))) or something completely different like v * (S * (R * X)) which of these are even equivalent? How do I know?



On top of that confusion I am wondering if a certain property holds however I am having the hardest time testing it because I am not certain about all the ordering/steps stuff above.



Is (S * R * X)^-1 the same as S^-1 * R^-1 * X^-1 or X^-1 * R^-1 * X^-1 or none of the above? You can see how determining this would be difficult without firm footing on the steps.



Could you please help me clear up which above statements are correct and how I can put parenthesis in these statements without changing the meaning and whether the vector gets multiplied on the left or the right? Additionally does that inverse property hold at all?



If it helps I am working with 3x3 matrices exclusively. Technically I am transforming 2D points with 2D transformations however I have to extend my point to a vector (p.x, p.y, 1) in order to be able to do the transform calculations.










share|cite|improve this question









$endgroup$












  • $begingroup$
    Fortunately, matrix multiplication is associative, so as long as you don't change the order, adding parentheses or not won't change the result.
    $endgroup$
    – Rylee Lyman
    Jan 28 at 3:03










  • $begingroup$
    So based on that v * (S * R * X) would be different than (S * R * X) * v why is this though? If I assume that (S * R * X) results in a matrix that does transformation T.
    $endgroup$
    – J.Doe
    Jan 28 at 3:06














1












1








1





$begingroup$


I have taken a linear algebra course however now that I have a project involving it I find myself extremely confused by two things. You see the class taught me that AB is not the same as BA but what it didnt help me out with is the ordering.



Yes, I can write out a list of what I need to do to a point but I am confused by which matrix goes on the left or the right. For example if I wanted to take a vector v in a screen space, scale it with matrix S then rotate it with matrix R then translate it with matrix X would the correct operation be v * S * R * X or (S * R * X) * v or S * R * X * v furthermore what is the ordering of these multiplications?



To calculate v * S * R * X can I do it like this (((v * S) * R) * X) or would it need to be like this (v * (S * (R * X))) or something completely different like v * (S * (R * X)) which of these are even equivalent? How do I know?



On top of that confusion I am wondering if a certain property holds however I am having the hardest time testing it because I am not certain about all the ordering/steps stuff above.



Is (S * R * X)^-1 the same as S^-1 * R^-1 * X^-1 or X^-1 * R^-1 * X^-1 or none of the above? You can see how determining this would be difficult without firm footing on the steps.



Could you please help me clear up which above statements are correct and how I can put parenthesis in these statements without changing the meaning and whether the vector gets multiplied on the left or the right? Additionally does that inverse property hold at all?



If it helps I am working with 3x3 matrices exclusively. Technically I am transforming 2D points with 2D transformations however I have to extend my point to a vector (p.x, p.y, 1) in order to be able to do the transform calculations.










share|cite|improve this question









$endgroup$




I have taken a linear algebra course however now that I have a project involving it I find myself extremely confused by two things. You see the class taught me that AB is not the same as BA but what it didnt help me out with is the ordering.



Yes, I can write out a list of what I need to do to a point but I am confused by which matrix goes on the left or the right. For example if I wanted to take a vector v in a screen space, scale it with matrix S then rotate it with matrix R then translate it with matrix X would the correct operation be v * S * R * X or (S * R * X) * v or S * R * X * v furthermore what is the ordering of these multiplications?



To calculate v * S * R * X can I do it like this (((v * S) * R) * X) or would it need to be like this (v * (S * (R * X))) or something completely different like v * (S * (R * X)) which of these are even equivalent? How do I know?



On top of that confusion I am wondering if a certain property holds however I am having the hardest time testing it because I am not certain about all the ordering/steps stuff above.



Is (S * R * X)^-1 the same as S^-1 * R^-1 * X^-1 or X^-1 * R^-1 * X^-1 or none of the above? You can see how determining this would be difficult without firm footing on the steps.



Could you please help me clear up which above statements are correct and how I can put parenthesis in these statements without changing the meaning and whether the vector gets multiplied on the left or the right? Additionally does that inverse property hold at all?



If it helps I am working with 3x3 matrices exclusively. Technically I am transforming 2D points with 2D transformations however I have to extend my point to a vector (p.x, p.y, 1) in order to be able to do the transform calculations.







linear-algebra matrices linear-transformations matrix-equations






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Jan 28 at 2:15









J.DoeJ.Doe

27829




27829












  • $begingroup$
    Fortunately, matrix multiplication is associative, so as long as you don't change the order, adding parentheses or not won't change the result.
    $endgroup$
    – Rylee Lyman
    Jan 28 at 3:03










  • $begingroup$
    So based on that v * (S * R * X) would be different than (S * R * X) * v why is this though? If I assume that (S * R * X) results in a matrix that does transformation T.
    $endgroup$
    – J.Doe
    Jan 28 at 3:06


















  • $begingroup$
    Fortunately, matrix multiplication is associative, so as long as you don't change the order, adding parentheses or not won't change the result.
    $endgroup$
    – Rylee Lyman
    Jan 28 at 3:03










  • $begingroup$
    So based on that v * (S * R * X) would be different than (S * R * X) * v why is this though? If I assume that (S * R * X) results in a matrix that does transformation T.
    $endgroup$
    – J.Doe
    Jan 28 at 3:06
















$begingroup$
Fortunately, matrix multiplication is associative, so as long as you don't change the order, adding parentheses or not won't change the result.
$endgroup$
– Rylee Lyman
Jan 28 at 3:03




$begingroup$
Fortunately, matrix multiplication is associative, so as long as you don't change the order, adding parentheses or not won't change the result.
$endgroup$
– Rylee Lyman
Jan 28 at 3:03












$begingroup$
So based on that v * (S * R * X) would be different than (S * R * X) * v why is this though? If I assume that (S * R * X) results in a matrix that does transformation T.
$endgroup$
– J.Doe
Jan 28 at 3:06




$begingroup$
So based on that v * (S * R * X) would be different than (S * R * X) * v why is this though? If I assume that (S * R * X) results in a matrix that does transformation T.
$endgroup$
– J.Doe
Jan 28 at 3:06










1 Answer
1






active

oldest

votes


















0












$begingroup$

When I do matrix operations, I typically will put the vector all the way on the right, and then for each operation I want to do, I'll add it to the left. So to take a vector $v$, and scale it with $S$, I would write $Sv$. To then rotate it via $R$, and then translate it with $T$, I would write $TRSv$.



The inverse of $TRS$ is $S^{-1}R^{-1}T^{-1}$. You can check this algebraically because when you write them next to each other, you can perform the cancellation without having to move anything—remember, because in general $AB neq BA$, we should avoid swapping the order at all costs.



NB – What I described in the first paragraph is one convention. Since it is possible to multiply an $ntimes n$ matrix and a vector on the left or on the right depending on whether you think of the vector as a $1times n$ or $ntimes 1$ matrix, you could write a consistent program using either standard. If you are working off of some preexisting structure, I would advise trying out both ways to get a feel for which is correct.






share|cite|improve this answer









$endgroup$













    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%2f3090362%2fwhere-can-you-put-parenthesis-inside-of-matrix-multiplication-expressions-does%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$

    When I do matrix operations, I typically will put the vector all the way on the right, and then for each operation I want to do, I'll add it to the left. So to take a vector $v$, and scale it with $S$, I would write $Sv$. To then rotate it via $R$, and then translate it with $T$, I would write $TRSv$.



    The inverse of $TRS$ is $S^{-1}R^{-1}T^{-1}$. You can check this algebraically because when you write them next to each other, you can perform the cancellation without having to move anything—remember, because in general $AB neq BA$, we should avoid swapping the order at all costs.



    NB – What I described in the first paragraph is one convention. Since it is possible to multiply an $ntimes n$ matrix and a vector on the left or on the right depending on whether you think of the vector as a $1times n$ or $ntimes 1$ matrix, you could write a consistent program using either standard. If you are working off of some preexisting structure, I would advise trying out both ways to get a feel for which is correct.






    share|cite|improve this answer









    $endgroup$


















      0












      $begingroup$

      When I do matrix operations, I typically will put the vector all the way on the right, and then for each operation I want to do, I'll add it to the left. So to take a vector $v$, and scale it with $S$, I would write $Sv$. To then rotate it via $R$, and then translate it with $T$, I would write $TRSv$.



      The inverse of $TRS$ is $S^{-1}R^{-1}T^{-1}$. You can check this algebraically because when you write them next to each other, you can perform the cancellation without having to move anything—remember, because in general $AB neq BA$, we should avoid swapping the order at all costs.



      NB – What I described in the first paragraph is one convention. Since it is possible to multiply an $ntimes n$ matrix and a vector on the left or on the right depending on whether you think of the vector as a $1times n$ or $ntimes 1$ matrix, you could write a consistent program using either standard. If you are working off of some preexisting structure, I would advise trying out both ways to get a feel for which is correct.






      share|cite|improve this answer









      $endgroup$
















        0












        0








        0





        $begingroup$

        When I do matrix operations, I typically will put the vector all the way on the right, and then for each operation I want to do, I'll add it to the left. So to take a vector $v$, and scale it with $S$, I would write $Sv$. To then rotate it via $R$, and then translate it with $T$, I would write $TRSv$.



        The inverse of $TRS$ is $S^{-1}R^{-1}T^{-1}$. You can check this algebraically because when you write them next to each other, you can perform the cancellation without having to move anything—remember, because in general $AB neq BA$, we should avoid swapping the order at all costs.



        NB – What I described in the first paragraph is one convention. Since it is possible to multiply an $ntimes n$ matrix and a vector on the left or on the right depending on whether you think of the vector as a $1times n$ or $ntimes 1$ matrix, you could write a consistent program using either standard. If you are working off of some preexisting structure, I would advise trying out both ways to get a feel for which is correct.






        share|cite|improve this answer









        $endgroup$



        When I do matrix operations, I typically will put the vector all the way on the right, and then for each operation I want to do, I'll add it to the left. So to take a vector $v$, and scale it with $S$, I would write $Sv$. To then rotate it via $R$, and then translate it with $T$, I would write $TRSv$.



        The inverse of $TRS$ is $S^{-1}R^{-1}T^{-1}$. You can check this algebraically because when you write them next to each other, you can perform the cancellation without having to move anything—remember, because in general $AB neq BA$, we should avoid swapping the order at all costs.



        NB – What I described in the first paragraph is one convention. Since it is possible to multiply an $ntimes n$ matrix and a vector on the left or on the right depending on whether you think of the vector as a $1times n$ or $ntimes 1$ matrix, you could write a consistent program using either standard. If you are working off of some preexisting structure, I would advise trying out both ways to get a feel for which is correct.







        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered Jan 28 at 3:08









        Rylee LymanRylee Lyman

        302210




        302210






























            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%2f3090362%2fwhere-can-you-put-parenthesis-inside-of-matrix-multiplication-expressions-does%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

            MongoDB - Not Authorized To Execute Command

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

            Npm cannot find a required file even through it is in the searched directory