# assign 2 letters in a subscript

Suppose I want to solve an equation for the matrix elements of $\bar{W}$: $$\alpha W_{ba}+\beta W_{bb}=x; \alpha W_{aa}+\beta W_{ab}=y$$

Using the syntax Subscript[W, ij] for my matrix element (on the $i$th row and $j$ th column), I get the following message:

Set::write: Tag Times in 2 x is Protected.

Is is possible at all to write such double subscript in Mathematica?

• Are you sure the error you're getting comes from the use of a double subscript? Subscript objects normally work fine inside of Solve; for an example, try Solve[{\[Alpha] Subscript[W, aa] + \[Beta] Subscript[W, ab] == y}, {Subscript[W, ab]}]. It would help to see your code so that we can more easily track down your error. – Michael Seifert Mar 13 '17 at 17:31
• You are right. My error came from a missing syntax in Solve. – E Be Mar 13 '17 at 17:36

Use Equal rather than Set in an equation.

I recommend that you use Format to display the output in subscripted form without subsequently having to enter subscripts.

Format[W[a_, b_]] := Subscript[W, StringJoin @@ ToString /@ {a, b}]

Solve[2 x == W[a, a], x][[1]]


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

Array[Subscript[a, #1, #2] &, {3, 3}] // MatrixForm

• I am trying to solve the following simple equation: Solve[2 x = Subscript[W, a, a], x] and get the error message Set::write: Tag Times in 2 x is Protected. Solve::naqs: Subscript[W, a,a] is not a quantified system of equations and inequalities.. why is that? – E Be Mar 13 '17 at 12:43