Question on how to write matrix(vertically or horizontally) that consist of column vectors

When Luis is teaching matrices linear transformation

make me have question on how to write the matrix, from my understanding, vector in math we normally write it as column vector which we write is vertically. like

[x

y

z]

then when I search it online, the transitional way of the matrix we write it as column vector stacking it horizontally(stacked columns)?

Here is ChatGPT’s answer

Here is my first confuse point, multiple resource said in math A matrix stacks column vectors horizontally by default, and it looks like this;

image

But in the end it said matrix shape is n*m, which if we draw it should looks like:

v1,v1,v1

v2,v2,v2

v3,v3,v3

And this is how we normal write it in numpy

So I checked again on GPT and here is the answer but I just want to have someone to double check and put all the thoughts together to help me to understand it. make sure I am not misunderstanding the concept:

1 Like

Dear @Bio_J,

Yes — you can think of a matrix as a collection of column vectors (or row vectors).

2x3 matrix using nested lists

A = [
[1, 2, 3],
[4, 5, 6]
]

print(“Matrix A:”)
for row in A:
print(row)

output

Matrix A:
[1, 2, 3]
[4, 5, 6]

import numpy as np

2x3 matrix using NumPy

A = np.array([[1, 2, 3],
[4, 5, 6]])

print(“Matrix A:”)
print(A)

output

Matrix A:
[[1 2 3]
[4 5 6]]


Keep Learning AI with DeepLearning.AI - Girijesh

1 Like

Hi Girijesh,

Thank you but I would like to know that what is the right way to write the matrix, vertically or horizontally.

1 Like

I think I thought of getting the point, when we say write matrix horizontally, what I mean is that first column is x axis and second column is y axis, but looks like the matrix is always writing vertically, to represent the point in a coordinate like the matrix [5,0][2,4], even the “2” is y axis for (5,2) but we still write it like that to allign with dot product rule, which is (x1 w 1 + x2 * w2) x is the x-axis value of all the vectors in the matrix

1 Like

Perhaps you are expecting a hard-and-fast rule that is used universally.
I do not think that exists. Even the instructor of this course isn’t consistent with himself.

1 Like

The example that instructor is taking is not very good example as the row and column are the same. also he should show the example in numpy… anyways I finally fingered out

1 Like