# How to get a factor extracted from a list?

I want to simplify the following expression:

{1/Sqrt[2], 1/Sqrt[2]}


How can I get the factor 1/Sqrt[2] in front of the parenthesis like:

1/Sqrt[2] {1, 1}


??

• It is not possible to put the expression into that form, as the multiplication would evaluate immediately. It may be possible to have 1/Sqrt[2] and {1, 1} as separate results, but in that case it is very important to make it clear what factors should or shouldn't be extracted. What about {Sqrt[2], Sqrt[3], 7, 5/2}? – Szabolcs Sep 5 '16 at 9:54
• I get your argument. However, to rapidly grasp the symmetry of a matrix by eye (I'm talking of 3x3 or 4x4 matrix) one would reduce/simplify the matrix. I just wanted to enforce MMA to do that for me... Your example is of course totally asymmetric :D – Kay Sep 5 '16 at 10:03
• Maybe just multiply manually with the factor that seems relevant by visual inspection (Sqrt[2] here). Or even use MatrixPlot, which should help in quickly determining a symmetry visually (then verify manually). – Szabolcs Sep 5 '16 at 10:05
• Possible duplicate: mathematica.stackexchange.com/questions/70131/… – Michael E2 Nov 5 '16 at 0:12

v = {1/Sqrt[2], 1/Sqrt[2]};

c = PolynomialGCD @@ v;

c*Defer @@ {v/c}

{1, 1}/Sqrt[2]


If you just want to view it you can try this.

Here is a mixed matrix with some parts that have Sqrt[2] in the denominator and some parts that do not.

matrix = {{1/Sqrt[2], 2/Sqrt[2]}, {3, Sqrt[2]}, {4, 3/Sqrt[2]},
{2./Sqrt[2], a/Sqrt[2]}};

MatrixForm[matrix]


$$\left( \begin{array}{cc} \frac{1}{\sqrt{2}} & \sqrt{2} \\ 3 & \sqrt{2} \\ 4 & \frac{3}{\sqrt{2}} \\ 1.41421 & \frac{a}{\sqrt{2}} \\ \end{array} \right)$$

Now multiply it by the Sqrt[2]

matrix2=Sqrt[2]*matrix;

MatrixForm[matrix2]


$$\left( \begin{array}{cc} 1 & 2 \\ 3 \sqrt{2} & 2 \\ 4 \sqrt{2} & 3 \\ 2. & a \\ \end{array} \right)$$

matrix2 the simplified matrix with 1/Sqrt[2] factored out.

In order to see it with the 1/Sqrt[2] outside try

HoldForm[1/Sqrt[2]] HoldForm[Evaluate[matrix2]]


Now you can get a temporary peek at the matrix with 1/Sqrt[2] moved to the outside.

Given the vector

v = {1/Sqrt[2], 4/Sqrt[2], (x + 3)/Sqrt[2]};


The following code

c = PolynomialGCD @@ v;
Print[c, " ", (v/c) // MatrixForm];


Outputs what you want

$$\frac{1}{\sqrt{2}} \begin{pmatrix} 1\\ 4\\ 3 + x\\ \end{pmatrix}$$