How Can You Solve Systems of Four Equations with Four Unknowns?

  • Thread starter A&X
  • Start date
  • Tags
    Unknowns
In summary: S[2] = S[3] = 0.; while(S[2] <= SMAX[2]){ while(S[3] <= SMAX[3]){ 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
  • #1
A&X
6
0

Homework Statement



Hello,

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)



Homework Equations



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



The Attempt at a Solution



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

R4=267.3(R1+R2+R3)/(R1+R2+R3-267.3)
R3=268.8(R1+R2+R4)/(R1+R2+R4-268.8)
R2=267.8(R1+R3+R4)/(R1+R3+R4-267.8)
R1=269.0(R2+R3+R4)/(R2+R3+R4-269.0)

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.
 
Physics news on Phys.org
  • #2
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.
 
  • #3
I don't think there is a way to do it analytically.

Run it through your favorite computer program, there are many solutions.
 
  • #4
Thank you for all the response.

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

[R1,R2,R3,R4]=solve('R1=269.0(R2+R3+R4)/(R2+R3+R4-269.0)','R2=267.8(R1+R3+R4)/(R1+R3+R4-267.8)','R3=268.8(R1+R2+R4)/(R1+R2+R4-268.8)','R4=267.3(R1+R2+R3)/(R1+R2+R3-267.3)','R1','R2','R3','R4')

However, I do not have access to MATLAB at the moment to check. Correct me if I am wrong
 
  • #5
Okay, MATLAB says:

Undefined function 'solve' for input arguments of type 'char'.
 
  • #6
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.
 
  • #7
rcgldr said:
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.
It is a numerical solution. There are many cases in practice where sets of equations are intractable algebraically and numerical solutions are required.
 
  • #8
A&X said:

Homework Statement



Hello,

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)



Homework Equations



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



The Attempt at a Solution



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

R4=267.3(R1+R2+R3)/(R1+R2+R3-267.3)
R3=268.8(R1+R2+R4)/(R1+R2+R4-268.8)
R2=267.8(R1+R3+R4)/(R1+R3+R4-267.8)
R1=269.0(R2+R3+R4)/(R2+R3+R4-269.0)

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.
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]
Next:
[tex]\frac{269.0}{(R1+R2+R3+R4)}=\frac{R1}{(R1+R2+R3+R4)}-\frac{(R1)^2}{(R1+R2+R3+R4)^2}[/tex]
Equivalently:
[tex]\frac{269.0}{y}=x_1-(x_1)^2[/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:
[tex]\frac{267.8}{y}=x_2-(x_2)^2[/tex][tex]\frac{265.8}{y}=x_3-(x_3)^2[/tex][tex]\frac{267.3}{y}=x_4-(x_4)^2[/tex]
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:
[tex]x_1=\frac{1-\sqrt{1-\frac{(4)(269.0)}{y}}}{2}[/tex]
(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.
 
  • #9
Chestermiller said:
... obtain a single equation in one unknown for y.
an equation with 4 roots, which could be another issue.

Here is the source code to the program I used:
Code:
/* 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]) +
                                (A[3]-C[3])*(A[3]-C[3]);
                        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]);
        printf("\n");
    }
    return(0);
}
 
Last edited:
  • #10
Mathematica is able to find exact solutions, but they are VERY complicated. Here is an example of just one solution for R1:

attachment.php?attachmentid=60705&stc=1&d=1375767430.jpg


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

attachment.php?attachmentid=60706&stc=1&d=1375767430.png
 

Attachments

  • Sol1.jpg
    Sol1.jpg
    16.8 KB · Views: 450
  • Sol2.png
    Sol2.png
    8.3 KB · Views: 660
  • #11
rcgldr said:
an equation with 4 roots, which could be another issue.
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:
[tex]\sqrt{\frac{1}{4}-\frac{(269.0)}{y}}+\sqrt{\frac{1}{4}-\frac{(267.8)}{y}}+\sqrt{\frac{1}{4}-\frac{(265.8)}{y}}+\sqrt{\frac{1}{4}-\frac{(267.3)}{y}}=1[/tex]
To solve this numerically, all I need is a good initial guess for y:
[tex]y^{(0)}=\frac{4s}{3}[/tex]
where s = (269.0+267.8+265.8+267.3)
and then I write:
[tex]y=\frac{4s}{3}+δ[/tex]
where δ is the parameter I will be solving for.
I also write:
[tex]269.0=\frac{s}{4}+(269.0-\frac{s}{4})[/tex]
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.
 
  • Like
Likes 1 person
  • #12
A&X said:
.

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?

.

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
 
  • #13
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:

>>equ1='269.0-R1*(R2+R3+R4)/(R1+R2+R3+R4)';
>>equ2='267.8-R2*(R1+R3+R4)/(R1+R2+R3+R4)';
>>equ3='265.8- R3*(R1+R2+R4)/(R1+R2+R3+R4)';
>>equ4='267.3 - R4*(R1+R2+R3)/(R1+R2+R3+R4)';
>>sol=solve(equ1,equ2,equ3,equ4);
>>R1=sol.R1
>>R2=sol.R2
>>R3=sol.R3
>>R4=sol.R4

R1 =

359.69396536017785860423709040818
1.3507021132304585888310244089084
-0.15281241991439544414763284998392
1.8490642922477590181409957542694


R2 =

357.28145453217212584831447055658
-1.3544948044533407508506455121324
0.15238453051809368598400290995311
1.8449211357365443870556345198613


R3 =

353.29653057117303395043663397118
-1.3494402487364598096284603749859
-0.1519010380142547092615828782759
-1.8507933465933516936061609699429


R4 =

356.28105339639228188360351205007
1.3464165716255193771005390620164
0.15224216764211807620525039756688
-1.8559902351679833508578661774425

And since R's cannot be negative, the only possible solution would be:
R1= 359.69396536017785860423709040818
R2=357.28145453217212584831447055658
R3=353.29653057117303395043663397118
R4=356.28105339639228188360351205007
 
  • #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:
[tex]R_j=2L_j-\frac{(L_1+L_2+L_3+L_4)}{6}[/tex]
where, in this example,

L1=269.0
L2=267.8
L3=265.8
L4=267.3

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

Chet
 
  • Like
Likes 1 person
  • #15
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!
 
  • #16
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)
 
  • #17
A&X said:
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)
You are going to kick yourself when you see this.
[tex]269.0=R1\frac{(R1+R2+R3+R4−R1)}{(R1+R2+R3+R4)}=R1\left(\frac{(R1+R2+R3+R4)}{(R1+R2+R3+R4)}-\frac{R1}{(R1+R2+R3+R4)}\right)[/tex]
Chet
 
  • Like
Likes 1 person
  • #18
Wow...how emberassing of me :shy:
 
  • #19
Chestermiller said:
[tex]R_j=2L_j-\frac{(L_1+L_2+L_3+L_4)}{6}[/tex]
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:
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:
  • #20
rcgldr said:
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:
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)(...) / (...) ?
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).

Chet
 

Related to How Can You Solve Systems of Four Equations with Four Unknowns?

1. What are the 4 equations and 4 unknowns?

The 4 equations and 4 unknowns refer to a system of linear equations with four variables that need to be solved simultaneously. The four equations are typically written in the form of ax + by + cz + dw = k, and the four unknowns are represented by the variables x, y, z, and w.

2. How do you solve a system of 4 equations and 4 unknowns?

To solve a system of 4 equations and 4 unknowns, you can use a variety of methods such as substitution, elimination, or matrix operations. The goal is to manipulate the equations to eliminate one variable at a time until you are left with a single solution for each unknown.

3. Can a system of 4 equations and 4 unknowns have more than one solution?

Yes, a system of 4 equations and 4 unknowns can have infinite solutions, no solution, or a unique solution. The number of solutions depends on the relationship between the equations and the values of the unknowns.

4. What is the significance of solving a system of 4 equations and 4 unknowns?

Solving a system of 4 equations and 4 unknowns is important in many fields of science and mathematics. It allows us to find the values of multiple variables that satisfy a set of equations, which can help us understand and model real-world situations.

5. Are there any real-world applications of a system of 4 equations and 4 unknowns?

Yes, there are many real-world applications of a system of 4 equations and 4 unknowns. For example, it can be used to solve problems in engineering, physics, economics, and other fields where multiple variables are involved. It can also be used to analyze and optimize complex systems.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
18
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
15
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
28
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
13
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
28
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Introductory Physics Homework Help
Replies
9
Views
2K
Back
Top