# Solve in terms of specific variables

As part of my physics homework (which I do not need the answer for, as I did it by hand, and got the correct $$\frac{m_1 g-m_2 g \sin(\theta)}{-m_1-m_2}$$ as the answer) I would have liked to have solved the following system of equations as shown (i.e. put $a_1$ as Subscript[a,1] and not a1 or something similar. The equations that I wanted to solve were:

1. Subscript[m, 2] Subscript[a, 2 x] == T - Subscript[m, 2] g Sin[\[Theta]]
2. Subscript[m, 1] Subscript[a, 1 y] == T - Subscript[m, 1] g
3. Subscript[a, 2 x] == -Subscript[a, 1 y]

I tried the following, and was given {} as the answer (which is clearly false):

Solve[Subscript[m, 2] Subscript[a, 2 x] == T - Subscript[m, 2] g Sin[\[Theta]] && Subscript[m, 1] Subscript[a, 1 y] == T - Subscript[m, 1] g && Subscript[a, 2 x] == -Subscript[a, 1 y], Subscript[a, 1 y]]

It seems that there at least two problems with the equations that I am asking it to solve.

1. I do not think that it is treating $a_{1y}$ as a variable. When I typed a in the part of solve that asks for the variables that I am solving for, all terms that have a in them light up as blue, but when I enter the subscript, it loses that highlighting.

2. It would seem (at least to me) that a perfectly valid answer to Solve would be $-a_{2x}$ but that would be a useless answer, as I want the answer in terms of $m_1 , m_2 , g, \theta$ and not in terms of other "compound variables"

Note: When I tried a "subscript-less" version (Solve[m2 a2x == T - m2 g Sin[\[Theta]] && m1 a1y == T - m1 g && a2x == -a1y, a1y] I still got {} as the answer. Using Mathematica 8.

What is going on, and how can I enter the equations normally, and solve for them in terms of specific variables?

Well, I'm not an expert on this and I always fight when I do these stuff, but this is what I think.

You are using symbols in your equations. To Mathematica, this probably means that they are something unkown but that something could be anything. If you put the symbols as last arguments, those are the ONLY symbols it will try to "generate conditions" to make the equations fit, for ANY value of the other symbols... (this is a generality. Read the long help then. You can set domain specifications, or quantifiers like Exists)

So, for example,

Solve[x == y && x == -y, x]


will give an empty list even though y=0 is a solution. So in that case you have two options. Either specify y as a symbol to solve too

In:= Solve[x == y && x == -y, {x, y}]

Out= {{x -> 0, y -> 0}}


or use some version that will generate the conditions on y

Solve[x == y && x == -y]


{{x -> 0, y -> 0}} or

Reduce[x == y && x == -y]


y == 0 && x == 0

You could also explicitly ask solve to eliminate y

Solve[x == y && x == -y, x, {y}]


which is equivalent to

Solve[Exists[y, x == y && x == -y], x]


{{x -> 0}} Back to your case. Conclusion: either use reduce or add more symbols to the variable list. I can definitely find values for a2x, T, m1, g, that make the last two equations impossible to be satisfied.

• what should I add to the list of variables to get the answer at the top of my question? I cannot seem to figure it out (Just replacing Solve with Reduce shows many answers, but none of them are in the or that I want). Mar 4, 2012 at 4:00
• @soandos, well, you clearly don't want your solution in terms of T or a2x, so add those
– Rojo
Mar 4, 2012 at 4:03