# Trouble in solving simultaneous equations with subscripts

My goal is to solve equation with subscripts. But the result shows {{}}. Strange enough, If I don't use subscripts, result shows. Is there a limitation in using subscripts? How to fix code below?

This code doesn't work. How to fix to use subscript?

 Clear["Global*"]
Solve[Subscript[y, 1] == Subscript[x, 1] + Subscript[x, 2] &&
Subscript[y, 2] == Subscript[x, 1]/(
Subscript[x, 1] + Subscript[x, 2]), {Subscript[x, 1], Subscript[x,
2]}]


This code works with no subscript.

Clear["Global*"]
Solve[y1 == x1 + x2 && y2 == x1/(x1 + x2), {x1, x2}]

• Don't use subscripts. Subscripts are primarily a formatting command. Use arrays a[[1]], a[[2]].. or functions a[1], a[2], instead Apr 29 at 15:13
• If you really need the output to have subscripts, you can use what @bills recommends and then convert to subscripts at the end: sol = Solve[y[1] == x[1] + x[2] && y[2] == x[1]/(x[1] + x[2]), {x[1], x[2]}]; sol /. x[i_] -> Subscript[x, i] /. y[i_] -> Subscript[y, i].
– JimB
Apr 29 at 15:55
• MMA version 12.1 Both calculations work for me. Apr 29 at 15:58
• You can format the display of indexed variables with subscripts, e.g., Clear["Global*"]; Format[x[n_]] := Subscript[x, n]; Format[y[n_]] := Subscript[y, n]; Solve[y[1] == x[1] + x[2] && y[2] == x[1]/(x[1] + x[2]), {x[1], x[2]}]` Apr 29 at 17:38

## 1 Answer

The output of your code would print as a list of associations showing the solution for x_1 and x_2. In regards to the {{}} present in the solution, this is the output of Solve[] when the there are multiple solutions.

https://reference.wolfram.com/language/ref/Solve.html

If you want to shorten what you typed, you can use the keyboard shortcut ctrl+- to type the subscript in line.