How to solve these simultaneous equations?

Hello community,

I am university student. I started to use Mathematica in few days ago.
I want to solve the following simultaneous equations. I tried “Solve” and “NSolve”, but I could not obtain answers. Do I make a mistake using these functions?

Please tell me how to solve these equations.
Which functions are proper to solve these equations?

Sqrt[(-19.4 + x)^2 + (20.8 + y)^2 + (-11.4 + z)^2] + Sqrt[ x^2 + y^2 + z^2]=-10.496

Sqrt[(-16.5 + x)^2 + (29.2 + y)^2 + (-6.7 + z)^2] + Sqrt[ x^2 + y^2 + z^2]=-8.382

Sqrt[(-17.6 + x)^2 + (33.2 + y)^2 + (1.3 + z)^2] + Sqrt[ x^2 + y^2 + z^2] =-8.938

For setting up equations, use == , not =. However, they don’t appear to have a solution.

NSolve[{Sqrt[(-19.4 + x)^2 + (20.8 + y)^2 + (-11.4 + z)^2] + 
    Sqrt[x^2 + y^2 + z^2] == -10.496, 
  Sqrt[(-16.5 + x)^2 + (29.2 + y)^2 + (-6.7 + z)^2] + 
    Sqrt[x^2 + y^2 + z^2] == -8.382, 
  Sqrt[(-17.6 + x)^2 + (33.2 + y)^2 + (1.3 + z)^2] + 
    Sqrt[x^2 + y^2 + z^2] == -8.938}, {x, y, z}]

{}

You can start by trying FindRoot

eq1 = Sqrt[(-19.4 + x)^2 + (20.8 + y)^2 + (-11.4 + z)^2] + Sqrt[x^2 + y^2 + z^2] == -10.496;
eq2 = Sqrt[(-16.5 + x)^2 + (29.2 + y)^2 + (-6.7 + z)^2] + Sqrt[x^2 + y^2 + z^2] == -8.382;
eq3 = Sqrt[(-17.6 + x)^2 + (33.2 + y)^2 + (1.3 + z)^2] + Sqrt[x^2 + y^2 + z^2] == -8.938;
FindRoot[{eq1, eq2, eq3}, {x, 1}, {y, 1}, {z, 1}]
{x -> 5.46311, y -> -2.52191, z -> -0.822461}

If you can setup your system as Ax=b, you can also try LinearSolve which obtain least squares approximation of solution. But your equations are not linear, so this would not work in this case. There might be other methods, but if NSolve fails, that is what I try next (btw, use the Reals option with NSolve and Solve helps sometimes finding a solution, but not in this case). May be someone else will have better answer for you.

FindRoot issues a line search tolerance warning and doesn’t find a very good solution:

eq1 = Sqrt[(-19.4 + x)^2 + (20.8 + y)^2 + (-11.4 + z)^2] + 
    Sqrt[x^2 + y^2 + z^2] == -10.496;
eq2 = Sqrt[(-16.5 + x)^2 + (29.2 + y)^2 + (-6.7 + z)^2] + 
    Sqrt[x^2 + y^2 + z^2] == -8.382;
eq3 = Sqrt[(-17.6 + x)^2 + (33.2 + y)^2 + (1.3 + z)^2] + 
    Sqrt[x^2 + y^2 + z^2] == -8.938;
sln = FindRoot[{eq1, eq2, eq3}, {x, 1}, {y, 1}, {z, 1}]

({eq1, eq2, eq3} /. a_ == b_ -> a - b ) /. sln
{42.602, 44.29, 48.0062}

Reduce thinks there’s no solution:

eqs = {Sqrt[(-19.4 + x)^2 + (20.8 + y)^2 + (-11.4 + z)^2] + 
    Sqrt[x^2 + y^2 + z^2] == -10.496, 
  Sqrt[(-16.5 + x)^2 + (29.2 + y)^2 + (-6.7 + z)^2] + 
    Sqrt[x^2 + y^2 + z^2] == -8.382, 
  Sqrt[(-17.6 + x)^2 + (33.2 + y)^2 + (1.3 + z)^2] + 
    Sqrt[x^2 + y^2 + z^2] == -8.938}  
  In[3]:= Reduce[eqs]

During evaluation of In[3]:= Reduce::ratnz: Reduce was unable to solve the system with inexact coefficients. The answer was obtained by solving a corresponding exact system and numericizing the result. >>

Out[3]= False

Given that Sqrt[] always returns a non-negative result, I don’t see how there could be a solution.

Ah, Yes Frank – While I was examining the trees you noticed the forest. :wink: