# How to take transpose of a one dimensional vector? [closed]

Why the two followings giving me same output? At least one should give me a row vector and another should give me a column vector.

MatrixForm[u = {1 , 1, -1, 1}]

MatrixForm[v = {{1}, {1}, {-1}, {1}}]


When I am trying to get transpose of u by taking Transpose[u], I am Mathematica is showing ""The first two levels of the one-dimensional list {1,1,-1,1} cannot be transposed"". So how to take transpose of a one dimensional vector?

• Mathematica's internal representation of a one-dimensional vector is the same as a (one-dimensional) list, which allows Dot[a,b] to be defined generally, even for lists that are not of numbers. As such, the internal representation does not admit a Transpose of a one-dimensional list. Why do you want the transpose of a one-dimensional vector (or list)? Jan 1, 2015 at 17:53
• MatrixForm[u = {{1 , 1, -1, 1}}] might be what you want. Jan 1, 2015 at 18:00
• The function Transpose permutes two (or more) distinct levels in an array/tensor. Your vector/list has only one level, so transposition is not possible. The way transposing a vector was explained to me in linear algebra was that we may consider a vector as a either a row matrix or a column matrix, which may be transposed. In Mathematica, a row matrix has the form {{1 , 1, -1, 1}}, as Sungmin points out. Jan 1, 2015 at 18:32
• I cannot resist the temptation to mention a point that I always strongly emphasized in my courses. A vector is just a list. What is called a row vector of a column vector are just two different (matrix) notations for the same vector. A vector cannot be transposed, but we can switch from one notation to another by transposing the matrix notation. I am happy to see that Mathematica treats vectors in the same way. Jan 1, 2015 at 19:21
• You might be interested in this answer. Jan 1, 2015 at 23:19

u = {{1, 1, -1, 1}}
(* NOT u = {1 , 1, -1, 1}, which is a list, I think *)
v = {{1}, {1}, {-1}, {1}}
MatrixForm[u]
MatrixForm[v]


Also

Transpose[u]