# Apply HoldForm on only a part of an expression

This expression:

Det[Array[a, {3, 3}]]


is evaluated as:

$$-a(1,3) a(2,2) a(3,1)+a(1,2) a(2,3) a(3,1)+a(1,3) a(2,1) a(3,2)-a(1,1) a(2,3)a(3,2)-a(1,2) a(2,1) a(3,3)+a(1,1) a(2,2) a(3,3)$$

If I HoldForm it:

HoldForm[Det[Array[a, {3, 3}]]


Neither Det or Array is evaluated:

$$| \text{Array}[a,\{3,3\}]|$$

However, is it possible to hold Det only, so that it prints:

$$\text{Det}\left( \begin{array}{ccc} a(1,1) & a(1,2) & a(1,3) \\ a(2,1) & a(2,2) & a(2,3) \\ a(3,1) & a(3,2) & a(3,3) \\ \end{array} \right)$$

?

• I think Inactivate would give you the fine grain control you seek. You can inactivate one head specifically, e.g. Det, while leaving everything else as it normally would be. Dec 28, 2021 at 14:53

In addition to the solutions of Nasser and Syed you could inactivate the Det function like this:

array = Array[a, {3, 3}];

Inactive[Det][array]


If you want it in the matrix form, you can do it either like in the answer of Nasser, or like this:

MapAt[MatrixForm, Inactive[Det][array], {1}]


In the both cases, Det will be shown blended.

Have fun!

However, is it possible to hold Det only, so that it prints:

$$\text{Det}\left( \begin{array}{ccc} a(1,1) & a(1,2) & a(1,3) \\ a(2,1) & a(2,2) & a(2,3) \\ a(3,1) & a(3,2) & a(3,3) \\ \end{array} \right)$$

I am not sure if you mean you want Latex output, or Mathematica output for display only.

If you mean Mathematica output for display use only, then you can take advantage that MatrixForm is a wrapper which prevents evaluation. So you can

ClearAll[a]
array = Array[a, {3, 3}]
Det[MatrixForm[array]]


You can not use the above for computation, since MatrixForm is inside.

If you want later to use normal array, you can do

Det[array]

• It should read: "You can NOT use the above for computation, since MatrixForm is inside." Dec 28, 2021 at 8:50
• @DanielHuber. Thanks. typo fixed. Dec 28, 2021 at 8:52

For display purposes only:

arr = Array[a, {3, 3}]