We know that the notation `[1, 2, 3]`

is used to create an array. In fact, this notation denotes a special type of array, called a (column) **vector** in Julia, as shown in the following screenshot:

To create this as a row vector (`1 2 3`

), use the notation `[1 2 3]`

with spaces instead of commas. This array is of type `1 x 3 Array{Int64,2}`

, so it has two dimensions. (The spaces used in `[1, 2, 3]`

are for readability only, we could have written this as `[1,2,3]`

).

A matrix is a two- or multidimensional array (in fact, a matrix is an alias for the two-dimensional case). We can write this as follows:

Array{Int64, 1} == Vector{Int64} #> true Array{Int64, 2} == Matrix{Int64} #> true

As matrices are so prevalent in data science and numerical programming, Julia has an amazing range of functionalities for them.

To create a matrix, use space-separated values for the columns and semicolon-separated for the rows:

// code in Chapter 5\matrices.jl: matrix = [1 2; 3 4] 2x2 Array{Int64,2}: 1 2 ...