1. PF Contest - Win "Conquering the Physics GRE" book! Click Here to Enter
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

4 Equations and 4 Unknowns

  1. Aug 5, 2013 #1


    User Avatar

    1. The problem statement, all variables and given/known data


    Although this could be labeled as an EE problem, this is more of an Algebra problem. Anyways, I am having a very hard time solving for the following 4 equations with 4 unknonws.

    269.0 = R1*(R2+R3+R4)/(R1+R2+R3+R4)

    267.8 = R2*(R1+R3+R4)/(R1+R2+R3+R4)

    265.8 = R3*(R1+R2+R4)/(R1+R2+R3+R4)

    267.3 = R4*(R1+R2+R3)/(R1+R2+R3+R4)

    2. Relevant equations

    Can I set R2 & R3 = 0 to make it easier to simplify it?

    3. The attempt at a solution

    This is what I was able to narrow it down to:


    I don't know what to do from here on now. When I tried replacing R1 into R2, R2 into R3, etc. it just kept getting messier and it didn't lead to anything promising.

    So I figured I set R2 & R3 = 0 to make it easier, but I don't know if I am allowed to do that. Can someone please lead me to the right direction?

    Your help is much appreciated,

    Thank you.
  2. jcsd
  3. Aug 5, 2013 #2


    Staff: Mentor

    I guess I'd try a numerical solution (ie write a program) trying all combinations of r1, r2, r3 and r4 within a given range. I can't see any way to reduce it algebraically and I don't think assuming r2=r3=0 will help either.

    What if you tried multiplying both sides by (r1+r2+r3+r4) and then tried doing linear algebra on it to cancel righthand side terms like r2*r3 vs r3*r2 (subtract eqn3 from eqn2 ...)? I didn't try it but it probably still gets messy.
  4. Aug 5, 2013 #3
    I don't think there is a way to do it analytically.

    Run it through your favorite computer program, there are many solutions.
  5. Aug 5, 2013 #4


    User Avatar

    Thank you for all the response.

    Using Matlab to solve, I think this is what the code would be:


    However, I do not have access to matlab at the moment to check. Correct me if I am wrong
  6. Aug 5, 2013 #5


    Staff: Mentor

    Okay, MATLAB says:

    Undefined function 'solve' for input arguments of type 'char'.
  7. Aug 5, 2013 #6


    User Avatar
    Homework Helper

    I created a program to search for values with minimum least square difference, to 4 digits I get:

    R1 = 359.6940
    R2 = 357.2815
    R3 = 353.2965
    R4 = 356.2810

    but this doesn't actually solve the 4 equations.
  8. Aug 5, 2013 #7


    User Avatar

    Staff: Mentor

    It is a numerical solution. There are many cases in practice where sets of equations are intractable algebraically and numerical solutions are required.
  9. Aug 5, 2013 #8
    I have a different way of approaching this problem that may work. Rewrite the first equation as:
    [tex]269.0 = R1*(R2+R3+R4)/(R1+R2+R3+R4)=R1*(R1+R2+R3+R4-R1)/(R1+R2+R3+R4)[/tex][tex]269.0=R1-\frac{(R1)^2}{(R1+R2+R3+R4)}[/tex]
    where y=(R1+R2+R3+R4) and [itex]x_1=\frac{R1}{(R1+R2+R3+R4)}=\frac{R1}{y}[/itex]
    From the other equations, we have:
    Clearly, [itex]x_1+x_2+x_3+x_4=1[/itex]
    If we solve the first equation for x1 in terms of y, we obtain:
    (I'm guessing that the minus sign is the correct one to use.)
    We obtain similar equations for x2, x3, and x4. If we add the four solutions for the x's together, we eliminate the x's using [itex]x_1+x_2+x_3+x_4=1[/itex], and obtain a single equation in one unknown for y.
  10. Aug 6, 2013 #9


    User Avatar
    Homework Helper

    an equation with 4 roots, which could be another issue.

    Here is the source code to the program I used:
    Code (Text):

    /* 269.0 = R1*(R2+R3+R4)/(R1+R2+R3+R4) */
    /* 267.8 = R2*(R1+R3+R4)/(R1+R2+R3+R4) */
    /* 265.8 = R3*(R1+R2+R4)/(R1+R2+R3+R4) */
    /* 267.3 = R4*(R1+R2+R3)/(R1+R2+R3+R4) */

    #include <stdio.h>
    #include <math.h>

    static double A[4] =            /* equation values, actual */
        {269.0, 267.8, 265.8, 267.3};
    static double B[4], C[4];       /* equation values, best, current */
    static double R[4], S[4];       /* variables, best, current */
    static double SMIN[4], SMAX[4]; /* range for current variables */
    static double BLSQ, CLSQ;       /* least squares, best, current */
    static double DS;               /* delta step */

    int main(void)
        BLSQ = 100000000.;          /* init best least squares to large value */
        DS   = 1000.;               /* init delta step */
        R[0] = 1000.;               /* init variables */
        R[1] = 1000.;
        R[2] = 1000.;
        R[3] = 1000.;
        while(DS > .0000005){
            SMIN[0] = R[0]-DS;      /* set ranges */
            SMIN[1] = R[1]-DS;
            SMIN[2] = R[2]-DS;
            SMIN[3] = R[3]-DS;
            SMAX[0] = R[0]+DS;
            SMAX[1] = R[1]+DS;
            SMAX[2] = R[2]+DS;
            SMAX[3] = R[3]+DS;
            DS /= 10.;
            for(S[0] = SMIN[0]; S[0] <= SMAX[0]; S[0] += DS){    
                for(S[1] = SMIN[1]; S[1] <= SMAX[1]; S[1] += DS){    
                    for(S[2] = SMIN[2]; S[2] <= SMAX[2]; S[2] += DS){    
                        for(S[3] = SMIN[3]; S[3] <= SMAX[3]; S[3] += DS){    
                            C[0] = S[0]*(S[1]+S[2]+S[3])/(S[0]+S[1]+S[2]+S[3]);
                            C[1] = S[1]*(S[0]+S[2]+S[3])/(S[0]+S[1]+S[2]+S[3]);
                            C[2] = S[2]*(S[0]+S[1]+S[3])/(S[0]+S[1]+S[2]+S[3]);
                            C[3] = S[3]*(S[0]+S[1]+S[2])/(S[0]+S[1]+S[2]+S[3]);
                            CLSQ =  (A[0]-C[0])*(A[0]-C[0]) +
                                    (A[1]-C[1])*(A[1]-C[1]) +
                                    (A[2]-C[2])*(A[2]-C[2]) +
                            if(CLSQ < BLSQ){    /* if new best */
                                BLSQ = CLSQ;    /*   update params */
                                B[0] = C[0];
                                B[1] = C[1];
                                B[2] = C[2];
                                B[3] = C[3];
                                R[0] = S[0];
                                R[1] = S[1];
                                R[2] = S[2];
                                R[3] = S[3];
            printf("A = %12.7lf %12.7lf %12.7lf %12.7lf\n",A[0],A[1],A[2],A[3]);
            printf("B = %12.7lf %12.7lf %12.7lf %12.7lf\n",B[0],B[1],B[2],B[3]);
            printf("R = %12.7lf %12.7lf %12.7lf %12.7lf\n",R[0],R[1],R[2],R[3]);
    Last edited: Aug 6, 2013
  11. Aug 6, 2013 #10

    The Electrician

    User Avatar
    Gold Member

    Mathematica is able to find exact solutions, but they are VERY complicated. Here is an example of just one solution for R1:


    Numerically, here is a solution good to quite a few decimal places, with the four expressions evaluated with the solution, showing its accuracy:


    Attached Files:

  12. Aug 6, 2013 #11
    This physical problem is going to have only one physically realistic answer. I can obtain a very accurate numerical solution to that answer by hand with very little effort. From my previous post, the algebraic equation I get for y is as follows:
    To solve this numerically, all I need is a good initial guess for y:
    where s = (269.0+267.8+265.8+267.3)
    and then I write:
    where δ is the parameter I will be solving for.
    I also write:
    where [itex](269.0-\frac{s}{4})[/itex] is small compared to s/4
    I write similar equations for the other three values. I then substitute into the equation for y, and linearize with respect to δ. I then solve the simple linear equation for δ. I guarantee this will give an accurate answer for y.
  13. Aug 6, 2013 #12


    User Avatar
    Homework Helper
    Gold Member

    Because the LHS all nearly equal, if you are doing it by successive approximations R1=R2=R3=R4 will give you an R s that are all close to a solution.

    They will probably be the engineering one, not obvious whether it is the only one
  14. Aug 6, 2013 #13


    User Avatar

    Thank you all for all the inputs. This problem is for a strain gage with values in a closed bridge with 4 measurements (for those who were curious what this problem was about).

    Here's how I was able to solve it using Matlab:

    >>equ3='265.8- R3*(R1+R2+R4)/(R1+R2+R3+R4)';
    >>equ4='267.3 - R4*(R1+R2+R3)/(R1+R2+R3+R4)';

    R1 =


    R2 =


    R3 =


    R4 =


    And since R's cannot be negative, the only possible solution would be:
    R1= 359.69396536017785860423709040818
  15. Aug 7, 2013 #14
    For whatever it's worth, I completed the linearized analysis of this problem that I outlined in my two previous posts in this thread. The final analytic results came out very simple, and the calculations can be readily done on a hand calculator:
    where, in this example,


    The results agree with the Matlab values to one unit in the fifth significant figure.

  16. Aug 7, 2013 #15


    User Avatar

    I checked your formula with different values for L's and compared with the matlab code and it is actually pretty accurate.

    In fact, with this formula I can make a spreadsheet on excel which is much more user friendly. Thank you Chestermiller!
  17. Aug 7, 2013 #16


    User Avatar

    By the way Chestermiller, I tried following your work and I was able to follow along for the most part. However, one step you did that i cannot figure it out how you did it is the third step.

    How do you go from: 269.0=R1∗(R1+R2+R3+R4−R1)/(R1+R2+R3+R4)
    To: 269.0= R1− (R1)^2/(R1+R2+R3+R4)
  18. Aug 7, 2013 #17
    You are going to kick yourself when you see this.
  19. Aug 7, 2013 #18


    User Avatar

    Wow...how emberassing of me :shy:
  20. Aug 7, 2013 #19


    User Avatar
    Homework Helper

    I tried this and there are some differences, but it could be the the formula is correct, and that the L values have a relationship that doesn't quite match the stated values due to just 4 digits of precision. The first set of values are what I get from my program and match the matlab results to 10 digits. The second set of values are what I get from the linear formula:

    Code (Text):

    R =  359.6939654  357.2814545  353.2965306  356.2810534
    L =  269.0000000  267.8000000  265.8000000  267.3000000

    R =  359.6833333  357.2833333  353.2833333  356.2833333
    L =  268.9934789  267.7997038  265.7921330  267.2999141
    If you substitute the L's for the R's in the original equation, say just the first one, does it work out?

    L1 = R1*(R2+R3+R4) / (R1+R2+R3+R4) = (2*L1 - (L1+L2+L3+L4)/6)(...) / (...) ?
    Last edited: Aug 7, 2013
  21. Aug 7, 2013 #20
    The equation I gave is an approximate solution to the equations, obtained by linearizing them. I'm sure you will agree that getting a solution that is accurate to 4 significant figures isn't too bad, especially since the input data is only accurate to 4 significant figures and since the approximate solution is so simple to implement (not requiring a computer).

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted