# [✓]  One simple equation gets answer, similar one does not?

Posted 1 year ago
2132 Views
|
8 Replies
|
2 Total Likes
|
 In Mathematica 11.2, when I try Solve[{x + y == 12, y == 2 x}, {x}] I get {{x -> 4}} Looks good. But, if I do Solve[{x + y == 25, y == 4 x}, {x}] I get {{ }} ?
8 Replies
Sort By:
Posted 1 year ago
 Looks like you accidentally wrote y = 2x instead of y == 2x at some point. Execute Clear[y] and try Solve again.
Posted 1 year ago
 Thanks, Michael.That works in mathematica online! In[1]:=Solve[{x+y==25,y==4x},{x},{y}] Out[1]={{x->5}} Curiously, when I do this in 11.2, I get: Solve::ivar: 2 x is not a valid variable. Solve[{3 x == 25, 2 x == 4 x}, {x}, {2 x}] Weird.
Posted 1 year ago
 You can use the old syntax, specifying a list of variables to eliminate in the third argument: Solve[{x + y == 25, y == 4 x}, {x}, {y}] (* {{x -> 5}} *) 
Posted 1 year ago
 Thanks, Neil. I structured this exercise based on the problem in my algebra book, which specifically asks for it this way: Solve for x if y=4x and x+y=25 So for the set of values for y of {4x}, provide x. I'm not all that interested in y, and I really don't want to get the value for it.Oh, well. Solving for {x,y} does work. I'll keep an eye on it. Thanks, all!
Posted 1 year ago
 Is there a reason you don’t use Solve to solve your two equations with two unknowns (x and y)?If you change {x} to {x,y} you will always get the complete answer for either set of equations.
Posted 1 year ago
 Thanks Valeriu and Tanel. It's cool that the Reduce function works, sort of (I would expect given y==2, the result should be in terms of y==2). The biggest question I don't understand is why Solve for the first formula works, but not for the second, in all cases. I can repeat this in both online and the desktop version.
 Only Reduce is giving values In[7]:= Reduce[{x + y == 25, y == 4 x}, x] Out[7]= y == 20 && x == 5 and In[8]:= Reduce[{x + y == 12, y == 2 x}, {x}] Out[8]= y == 8 && x == 4 
 I get for both of them: In[1]:= Solve[{x + y == 12, y == 2 x}, {x}] Out[1]= {} In[2]:= Solve[{x + y == 25, y == 4 x}, {x}] Out[2]= {} As you try to solve systems with respect to only one variable, the results are correct.