Scalars, Vectors, and Matrices

The Wolfram Language represents matrices and vectors using lists. Anything that is not a list the Wolfram Language considers as a scalar.

A vector in the Wolfram Language consists of a list of scalars. A matrix consists of a list of vectors, representing each of its rows. In order to be a valid matrix, all the rows must be the same length, so that the elements of the matrix effectively form a rectangular array.

Functions for testing the structure of vectors and matrices.

The list {a,b,c} has the form of a vector:

VectorQ[{a,b,c}]

Anything that is not manifestly a list is treated as a scalar, so applying (RefLink[VectorQ, paclet:ref/VectorQ]) gives (RefLink[False, paclet:ref/False]):

VectorQ[x+y]

This is a 2×3 matrix:

Dimensions[{{a,b,c},{ap,bp,cp}}]

For a vector, (RefLink[Dimensions, paclet:ref/Dimensions]) gives a list with a single element equal to the result from (RefLink[Length, paclet:ref/Length]):

Dimensions[{a,b,c}]

This object does not count as a matrix because its rows are of different lengths:

MatrixQ[{{a,b,c},{ap,bp}}]