0
$\begingroup$

I have these three equations:

1/X + 1/Y == 1/15;
1/Y + 1/Z == 1/20;
1/Z + 1/X == 1/25;

I want to calculate the value of expression:

1/X + 1/Y + 1/Z

Here is what I tried:

  1. FullSimplify[1/X + 1/Y + 1/Z] which only returns 1/X + 1/Y + 1/Z.
  2. Evaluate[1/X + 1/Y + 1/Z] which also gives 1/X + 1/Y + 1/Z.

Is there any way to calculate the value of this expression and other such expressions in Mathematica.

I could do this by hand by simply adding all these equations and then dividing by 2.

2*(1/X + 1/Y + 1/Z) == 1/15 + 1/20 + 1/25;

However, how can I use Mathematica to calculate the value for me using just the first three eqautions?

$\endgroup$
0

2 Answers 2

2
$\begingroup$
Solve[{1/X + 1/Y == 1/15, 1/Y + 1/Z == 1/20, 1/Z + 1/X == 1/25}, {X, Y, Z}]
1/X + 1/Y + 1/Z /. %[[1]]
{{X -> 600/17, Y -> 600/23, Z -> 600/7}}

47/600

Eliminate[{r == 1/X + 1/Y + 1/Z, 1/X + 1/Y == 1/15, 1/Y + 1/Z == 1/20, 1/Z + 1/X == 1/25}, {X, Y, Z}]
600 r == 47

Reduce[{r == 1/X + 1/Y + 1/Z, 1/X + 1/Y == 1/15, 1/Y + 1/Z == 1/20, 1/Z + 1/X == 1/25}, {X, Y, Z}]
r == 47/600 && X == 600/17 && Y == 600/23 && Z == 600/7
$\endgroup$
2
  • $\begingroup$ Thanks Αλέξανδρος Ζεγγ :) What does /. %[[1]] do here? $\endgroup$
    – Real Noob
    Commented Oct 12, 2018 at 5:06
  • $\begingroup$ @RealNoob Please check with ReplaceAll, Out and Part. $\endgroup$ Commented Oct 12, 2018 at 5:08
2
$\begingroup$

Untested:

Total[LinearSolve[{{1, 1, 0}, {0, 1, 1}, {1, 0, 1}}, 1/{15, 20, 25}]]
$\endgroup$
5
  • $\begingroup$ (I'm on gedanken Mathematica; can someone verify if this works?) $\endgroup$ Commented Oct 12, 2018 at 5:33
  • $\begingroup$ @Yes, It gives 47/600 $\endgroup$ Commented Oct 12, 2018 at 5:34
  • $\begingroup$ Thanks JM. Could you please explain how this works. I read the documentation but it is still confusing. You did not use any of the variables here. :) $\endgroup$
    – Real Noob
    Commented Oct 12, 2018 at 5:48
  • $\begingroup$ Before anything else @Real: what do you know about matrices? $\endgroup$ Commented Oct 12, 2018 at 5:54
  • $\begingroup$ @RealNoob matrix of the coefficients. $\endgroup$ Commented Oct 12, 2018 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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