0
$\begingroup$

I was given a task to find the value of variable a,b,c,d,e and f. But I'm not sure it is even possible, given that only 5 equations are available. Can anybody point out how to solve these:

a+b+c=164.35;
d+e+f=94.44; 
a^2+d^2=20.06^2; 
b^2+e^2=74.34^2; 
c^2+f^2=123.27^2

Thank you.

$\endgroup$
3
$\begingroup$

EDIT 1:

If you know additional constraints for each variable, you can add them in to the list of equations.

sols = Solve[{
           a + b + c == 164.35, 
           d + e + f == 94.44, 
           a^2 + d^2 == 20.06^2, 
           b^2 + e^2 == 74.34^2, 
           c^2 + f^2 == 123.27^2, 
           a >= 0, 
           b >= 0, 
           c >= 0, 
           d >= 0, 
           e >= 0, 
           f >= 0
         }, 
         {a, b, c, d, e, f}, 
         Reals
       ]
sols[[3]]
(* {a->19.7827,b->23.001,c->121.566,d->3.32366,e->70.6922,f->20.4241} *)

sols[[3]] remains relatively simple, however the first 2 are still rather complicated expressions.

Original:

If you look up Solve or NSolve in the documentation centre, it should demonstrate some basic examples of how to use those functions.

sols = Solve[{
           a + b + c == 164.35, 
           d + e + f == 94.44, 
           a^2 + d^2 == 20.06^2, 
           b^2 + e^2 == 74.34^2, 
           c^2 + f^2 == 123.27^2
         }, 
         {a, b, c, d, e, f}, 
         Reals
       ]

The first 7 solutions returned are complicated ConditionalExpressions, but if you look as sols[[8 ;; 17]], those are fairly simple solutions with a numerical value for each of the variables. Of course, I'm assuming you're only looking for answers where all $a$ through $f$ are real. If that's not the case, you can drop the Reals part from the Solve command.

In general, there are many values of $a, b, c, d, e,$ and $f$ that satisfy the equations. I don't know if you have any further constraints, or if you simply need some solution.

$\endgroup$
  • $\begingroup$ Wow thanks. This is great. Yes, a through f are real values, but I forgot to mention that the values are positive number. Is there a way to add this constraint inside this? Another question is, the value may be a positive number, but it can also be zero, is there any way to represent my statement here? Thanks again. $\endgroup$ – Azlan Jun 12 at 2:49
  • $\begingroup$ @Azlan No problem. I've updated by answer to include your conditions. $\endgroup$ – MassDefect Jun 12 at 2:58
  • $\begingroup$ Great, thanks! This definitely solves my problem. $\endgroup$ – Azlan Jun 12 at 3:04
  • 1
    $\begingroup$ @Azlan Note that your intuition was correct: in general it is not possible to solve $n$ variables with only $n-1$ equations. In many cases, you would still be able to reduce complicated expressions to arrive at a family of solutions. Take, for example Reduce[{x+y+z==2,x+y==1},{x,y,z},Reals] which gives $z=1$ and $y=1-x$. This last part describes a line of points for which the equations hold. $\endgroup$ – LBogaardt Jun 12 at 14:33
  • $\begingroup$ @LBogaardt thanks for your comments, I was thinking about some similar argument when I got the assignment thus I came to ask the question here, in case anybody have any better idea. However, by applying the code that MassDefect has shown above, the answer did come out (with a few warnings). Further, by applying a few conditions, I can get one single answer that fits all of the equations and conditions. I believe (my assumption) Mathematica did go beyond reasonable measure to get that answer ie. "trial and error", which I am so thankful that I get to apply my theory on the assignment. $\endgroup$ – Azlan Jun 14 at 0:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.