# Why Mathematica does not return explicit output [closed]

I am new to Mathematica. One thing that I don't get is why if I define a matrix and give it a name, then use the name in another function, I get back the function itself. However, When I use an explicit matrix inside a function I get meaningful output. Compare the following two examples:

A = ( {
{a11, a12},
{a21, a22}
} ) //
Transpose[A] // MatrixForm


The output of the above is just the same function name Transpose[]

Transpose[(a11  a12
a21 a22
)]


But to get the actual transpose I have to provide the actual matrix as output like this.

Transpose[( {
{a11, a12},
{a21, a22}
} )] // MatrixForm


The output is what I want

(a11 a21
a12 a22)


Any explanation pleae?

• Transpose[A] returns the transpose of the matrix A, it does not change A itself. You can accomplish that by assigning it to a symbol, for example aT = Transpose[A] May 17 at 18:07
• @bills Sorry I wasn't clear. I edited the question. May 17 at 18:19
• Your first line of code, A = ({{a11, a12}, {a21, a22}}) // Transpose[A] // MatrixForm is incorrect and yields an error message. Use A = ({{a11, a12}, {a21, a22}}) // Transpose // MatrixForm instead. May 17 at 20:09

You need to be careful about the precedence of each operation. Here's your original:

A = ({{a11, a12}, {a21, a22}}) // Transpose[A] // MatrixForm


Here is how the precedences work out (note the parentheses):

A = ((({{a11, a12}, {a21, a22}}) // Transpose[A]) // MatrixForm)


So, starting with your matrix, you first applied Transpose[A] to it (so the Set isn't executed yet). Two problems: A isn't defined and Transpose[A] isn't a function, so at this point we have:

A = ((Transpose[A][{{a11, a12}, {a21, a22}}]) // MatrixForm)


Next we apply MatrixForm (again before the Set is executed). MatrixForm doesn't do anything visually, but the wrapper is still there. So now we have:

A = MatrixForm[Transpose[A][{{a11, a12}, {a21, a22}}]]


Now we're ready to evaluate the Set, but we're trying to define A with an expression that depends on A, so we get an infinite recursion.

I assume that what you want is something like this:

A = {{a11, a12}, {a21, a22}};
Transpose[A] // MatrixForm