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

Posted 1 year ago
2203 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 {{ }} ? Answer
8 Replies
Sort By:
Posted 1 year ago
 I get for both of them: In:= Solve[{x + y == 12, y == 2 x}, {x}] Out= {} In:= Solve[{x + y == 25, y == 4 x}, {x}] Out= {} As you try to solve systems with respect to only one variable, the results are correct. Answer
Posted 1 year ago
 Only Reduce is giving values In:= Reduce[{x + y == 25, y == 4 x}, x] Out= y == 20 && x == 5 and In:= Reduce[{x + y == 12, y == 2 x}, {x}] Out= y == 8 && x == 4 Answer
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. Answer
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. Answer
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! Answer
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}} *) Answer
Posted 1 year ago
 Thanks, Michael.That works in mathematica online! In:=Solve[{x+y==25,y==4x},{x},{y}] Out={{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. Answer
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. Answer