Solving a linear system of equations in 3 unknowns











up vote
0
down vote

favorite












I am having trouble solving this linear system of equations to get $theta_1$ and $theta_2$ as functions of $x$ and $y$ where $x_1, x_2, x_3$ and $y_1, y_2, y_3$ are constants:



$theta_1cdot x_1 + theta_2cdot x_2 + theta_3 cdot x_3 = x$



$theta_1cdot y_1 + theta_2cdot y_2 + theta_3 cdot y_3 = y$



$theta_1 + theta_2 + theta_3 = 1$



By using the condition $theta_3 = 1-theta_1 - theta_2$ i have got to the following two-by-two system of equations:



$theta_1(x_1-x_3) + theta_2(x_2-x_3) = x - x_3$



$theta_1(y_1-y_3) + theta_2(y_2-y_3) = y - y_3$



Can anyone help me as to how to proceed from here? Also, I have just been using brute-force so far and would like to know if there is an easier or more sophisticated way of solving this system as the above two equations look very similar.



Any help would be greatly appreciated, thanks guys!










share|cite|improve this question






















  • You are trying to compute the barycentric coordinates of $(x,y)$ relative to the triangle spanned by the $(x_k,y_k)$. What exactly is the problem of inverting the $3times 3$ matrix? Or solve the reduced $2times 2$ system? No one is saying that the solution has to look nice, or at least nicer than the Cramer solution formulas.
    – LutzL
    Nov 21 at 17:30















up vote
0
down vote

favorite












I am having trouble solving this linear system of equations to get $theta_1$ and $theta_2$ as functions of $x$ and $y$ where $x_1, x_2, x_3$ and $y_1, y_2, y_3$ are constants:



$theta_1cdot x_1 + theta_2cdot x_2 + theta_3 cdot x_3 = x$



$theta_1cdot y_1 + theta_2cdot y_2 + theta_3 cdot y_3 = y$



$theta_1 + theta_2 + theta_3 = 1$



By using the condition $theta_3 = 1-theta_1 - theta_2$ i have got to the following two-by-two system of equations:



$theta_1(x_1-x_3) + theta_2(x_2-x_3) = x - x_3$



$theta_1(y_1-y_3) + theta_2(y_2-y_3) = y - y_3$



Can anyone help me as to how to proceed from here? Also, I have just been using brute-force so far and would like to know if there is an easier or more sophisticated way of solving this system as the above two equations look very similar.



Any help would be greatly appreciated, thanks guys!










share|cite|improve this question






















  • You are trying to compute the barycentric coordinates of $(x,y)$ relative to the triangle spanned by the $(x_k,y_k)$. What exactly is the problem of inverting the $3times 3$ matrix? Or solve the reduced $2times 2$ system? No one is saying that the solution has to look nice, or at least nicer than the Cramer solution formulas.
    – LutzL
    Nov 21 at 17:30













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am having trouble solving this linear system of equations to get $theta_1$ and $theta_2$ as functions of $x$ and $y$ where $x_1, x_2, x_3$ and $y_1, y_2, y_3$ are constants:



$theta_1cdot x_1 + theta_2cdot x_2 + theta_3 cdot x_3 = x$



$theta_1cdot y_1 + theta_2cdot y_2 + theta_3 cdot y_3 = y$



$theta_1 + theta_2 + theta_3 = 1$



By using the condition $theta_3 = 1-theta_1 - theta_2$ i have got to the following two-by-two system of equations:



$theta_1(x_1-x_3) + theta_2(x_2-x_3) = x - x_3$



$theta_1(y_1-y_3) + theta_2(y_2-y_3) = y - y_3$



Can anyone help me as to how to proceed from here? Also, I have just been using brute-force so far and would like to know if there is an easier or more sophisticated way of solving this system as the above two equations look very similar.



Any help would be greatly appreciated, thanks guys!










share|cite|improve this question













I am having trouble solving this linear system of equations to get $theta_1$ and $theta_2$ as functions of $x$ and $y$ where $x_1, x_2, x_3$ and $y_1, y_2, y_3$ are constants:



$theta_1cdot x_1 + theta_2cdot x_2 + theta_3 cdot x_3 = x$



$theta_1cdot y_1 + theta_2cdot y_2 + theta_3 cdot y_3 = y$



$theta_1 + theta_2 + theta_3 = 1$



By using the condition $theta_3 = 1-theta_1 - theta_2$ i have got to the following two-by-two system of equations:



$theta_1(x_1-x_3) + theta_2(x_2-x_3) = x - x_3$



$theta_1(y_1-y_3) + theta_2(y_2-y_3) = y - y_3$



Can anyone help me as to how to proceed from here? Also, I have just been using brute-force so far and would like to know if there is an easier or more sophisticated way of solving this system as the above two equations look very similar.



Any help would be greatly appreciated, thanks guys!







linear-algebra matrices numerical-methods systems-of-equations matrix-equations






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Nov 21 at 17:14









Hallao

1




1












  • You are trying to compute the barycentric coordinates of $(x,y)$ relative to the triangle spanned by the $(x_k,y_k)$. What exactly is the problem of inverting the $3times 3$ matrix? Or solve the reduced $2times 2$ system? No one is saying that the solution has to look nice, or at least nicer than the Cramer solution formulas.
    – LutzL
    Nov 21 at 17:30


















  • You are trying to compute the barycentric coordinates of $(x,y)$ relative to the triangle spanned by the $(x_k,y_k)$. What exactly is the problem of inverting the $3times 3$ matrix? Or solve the reduced $2times 2$ system? No one is saying that the solution has to look nice, or at least nicer than the Cramer solution formulas.
    – LutzL
    Nov 21 at 17:30
















You are trying to compute the barycentric coordinates of $(x,y)$ relative to the triangle spanned by the $(x_k,y_k)$. What exactly is the problem of inverting the $3times 3$ matrix? Or solve the reduced $2times 2$ system? No one is saying that the solution has to look nice, or at least nicer than the Cramer solution formulas.
– LutzL
Nov 21 at 17:30




You are trying to compute the barycentric coordinates of $(x,y)$ relative to the triangle spanned by the $(x_k,y_k)$. What exactly is the problem of inverting the $3times 3$ matrix? Or solve the reduced $2times 2$ system? No one is saying that the solution has to look nice, or at least nicer than the Cramer solution formulas.
– LutzL
Nov 21 at 17:30










1 Answer
1






active

oldest

votes

















up vote
0
down vote













You can rewrite your system of equations in the following form:
$$begin{bmatrix} x_1 & x_2 & x_3\ y_1 & y_2 & y_3\ 1 & 1 & 1 end{bmatrix}begin{bmatrix} theta_1 \ theta_2 \ theta_3 end{bmatrix} = begin{bmatrix} x \ y \ 1 end{bmatrix}$$



If the matrix containing the $x_i$ and $y_i$ is invertible, you can find a unique solution for your $theta_i$ as:



$$begin{bmatrix} theta_1 \ theta_2 \ theta_3 end{bmatrix} = begin{bmatrix} x_1 & x_2 & x_3\ y_1 & y_2 & y_3\ 1 & 1 & 1 end{bmatrix}^{-1}begin{bmatrix} x \ y \ 1 end{bmatrix}$$



which you can calculate either directly or by using numerics. If your matrix is not invertible, then you do not have a unique solution and may have either no solution at all or an infinite number of solutions depending on the image of the matrix containing the $x_i$'s and $y_i$'s.






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: 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%2f3008045%2fsolving-a-linear-system-of-equations-in-3-unknowns%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








    up vote
    0
    down vote













    You can rewrite your system of equations in the following form:
    $$begin{bmatrix} x_1 & x_2 & x_3\ y_1 & y_2 & y_3\ 1 & 1 & 1 end{bmatrix}begin{bmatrix} theta_1 \ theta_2 \ theta_3 end{bmatrix} = begin{bmatrix} x \ y \ 1 end{bmatrix}$$



    If the matrix containing the $x_i$ and $y_i$ is invertible, you can find a unique solution for your $theta_i$ as:



    $$begin{bmatrix} theta_1 \ theta_2 \ theta_3 end{bmatrix} = begin{bmatrix} x_1 & x_2 & x_3\ y_1 & y_2 & y_3\ 1 & 1 & 1 end{bmatrix}^{-1}begin{bmatrix} x \ y \ 1 end{bmatrix}$$



    which you can calculate either directly or by using numerics. If your matrix is not invertible, then you do not have a unique solution and may have either no solution at all or an infinite number of solutions depending on the image of the matrix containing the $x_i$'s and $y_i$'s.






    share|cite|improve this answer

























      up vote
      0
      down vote













      You can rewrite your system of equations in the following form:
      $$begin{bmatrix} x_1 & x_2 & x_3\ y_1 & y_2 & y_3\ 1 & 1 & 1 end{bmatrix}begin{bmatrix} theta_1 \ theta_2 \ theta_3 end{bmatrix} = begin{bmatrix} x \ y \ 1 end{bmatrix}$$



      If the matrix containing the $x_i$ and $y_i$ is invertible, you can find a unique solution for your $theta_i$ as:



      $$begin{bmatrix} theta_1 \ theta_2 \ theta_3 end{bmatrix} = begin{bmatrix} x_1 & x_2 & x_3\ y_1 & y_2 & y_3\ 1 & 1 & 1 end{bmatrix}^{-1}begin{bmatrix} x \ y \ 1 end{bmatrix}$$



      which you can calculate either directly or by using numerics. If your matrix is not invertible, then you do not have a unique solution and may have either no solution at all or an infinite number of solutions depending on the image of the matrix containing the $x_i$'s and $y_i$'s.






      share|cite|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        You can rewrite your system of equations in the following form:
        $$begin{bmatrix} x_1 & x_2 & x_3\ y_1 & y_2 & y_3\ 1 & 1 & 1 end{bmatrix}begin{bmatrix} theta_1 \ theta_2 \ theta_3 end{bmatrix} = begin{bmatrix} x \ y \ 1 end{bmatrix}$$



        If the matrix containing the $x_i$ and $y_i$ is invertible, you can find a unique solution for your $theta_i$ as:



        $$begin{bmatrix} theta_1 \ theta_2 \ theta_3 end{bmatrix} = begin{bmatrix} x_1 & x_2 & x_3\ y_1 & y_2 & y_3\ 1 & 1 & 1 end{bmatrix}^{-1}begin{bmatrix} x \ y \ 1 end{bmatrix}$$



        which you can calculate either directly or by using numerics. If your matrix is not invertible, then you do not have a unique solution and may have either no solution at all or an infinite number of solutions depending on the image of the matrix containing the $x_i$'s and $y_i$'s.






        share|cite|improve this answer












        You can rewrite your system of equations in the following form:
        $$begin{bmatrix} x_1 & x_2 & x_3\ y_1 & y_2 & y_3\ 1 & 1 & 1 end{bmatrix}begin{bmatrix} theta_1 \ theta_2 \ theta_3 end{bmatrix} = begin{bmatrix} x \ y \ 1 end{bmatrix}$$



        If the matrix containing the $x_i$ and $y_i$ is invertible, you can find a unique solution for your $theta_i$ as:



        $$begin{bmatrix} theta_1 \ theta_2 \ theta_3 end{bmatrix} = begin{bmatrix} x_1 & x_2 & x_3\ y_1 & y_2 & y_3\ 1 & 1 & 1 end{bmatrix}^{-1}begin{bmatrix} x \ y \ 1 end{bmatrix}$$



        which you can calculate either directly or by using numerics. If your matrix is not invertible, then you do not have a unique solution and may have either no solution at all or an infinite number of solutions depending on the image of the matrix containing the $x_i$'s and $y_i$'s.







        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered Nov 21 at 20:26









        aghostinthefigures

        1,1211215




        1,1211215






























            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.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • 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.


            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%2f3008045%2fsolving-a-linear-system-of-equations-in-3-unknowns%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

            Ellipse (mathématiques)

            Quarter-circle Tiles

            Mont Emei