Philosophy, Computing, and Artificial Intelligence

PHI 319. Vectors and Matrices.

A vector is a list of numbers. The dimension of a vector is the number of its members. A matrix is a rectangular list of numbers. The dimension of a matrix is `m` x `n` (rows x columns).

Vectors and Row Vectors

A `m`-dimensional vector is a m x 1-dimensional matrix

`[[x_1],[x_2],[.],[.],[.],[x_m]] `

A `m`-dimensional row vector is the transpose of a m x `1`-dimensional matrix

`[[x_1],[x_2],[.],[.],[.],[x_m]]^T `

The Transpose Operator

The transpose operator T transposes a `m` x `1` matrix into a `1` x `m` matrix (and vice versa).

`[[x_1],[x_2],[.],[.],[.],[x_m]]^T = [x_1,x_2,.,.,.,x_m]`

`[x_1,x_2,.,.,.,x_m]^T = [[x_1],[x_2],[.],[.],[.],[x_m]]`

The Dot Product

If `bbx` and `bby` are `m`-vectors, the dot product `bbx * bby` is a number

`bbx^T bby = [x_1,x_2,.,.,.,x_m] [[y_1],[y_2],[.],[.],[.],[y_m]] = x_1 y_1 + x_2 y_2 + ... + x_m y_m = sum_i^m x_i y_i`


If `bbW` is a `m` x `n` matrix and `bbx` is a `n`-vector, the dot product is a `m`-vector

` bbW * bbx = [ [w_(11), w_(12), w_(13), ., ., ., w_(1n)], [w_(21), w_(22), w_(23), ., ., ., w_(2n)],[.,.,.,,,,.],[.,.,.,,,,.],[.,.,.,,,,.], [w_(m1), w_(m2), w_(m3), ., ., ., w_(mn)] ] [ [x_1], [x_2], [.], [.], [.], [x_n]] = [ [w_(11)x_1 + w_(12)x_2 + ... + w_(1n)x_n], [w_(21)x_1 + w_(22)x_2 + ... + w_(2n)x_n], [.], [.], [.], [w_(m1)x_1 + w_(m2)x_2 + ... + w_(mn)x_n]] `


If `bbW` is a `m` x `n` matrix and `bbY` is a `n` x `2` matrix, the dot product is a `m` x `2` matrix

` bbW * bbY = [ [w_(11), w_(12), w_(13), ., ., ., w_(1n)], [w_(21), w_(22), w_(23), ., ., ., w_(2n)],[.,.,.,,,,.],[.,.,.,,,,.],[.,.,.,,,,.], [w_(m1), w_(m2), w_(m3), ., ., ., w_(mn)] ] [ [x_(11), x_(12)], [x_(21), x_(22)], [.,.], [.,.], [.,.], [x_(n1), x_(n2)] ] `

           ` = [ [w_(11)x_(11) + w_(12)x_(21) + ... + w_(1n)x_(n1), w_(11)x_(12) + w_(12)x_(22) + ... + w_(1n)x_(n2)], [w_(21)x_(12) + w_(22)x_(22) + ... + w_(2n)x_(n2), w_(21)x_(12) + w_(22)x_(22) + ... + w_(2n)x_(n2)], [.,.], [.,.], [.,.], [w_(m1)x_(1n) + w_(m2)x_(2n) + ... + w_(mn)x_(n n), w_(m1)x_(12) + w_(m2)x_(22) + ... + w_(mn)x_(n n)]] `


An example makes this a little clearer.

` bbA = [[1,2,3],[4,5,6]]`    ` bbB = [[1,2],[1,2],[1,2]] `       `bbA * bbB = [ [6, 15], [12, 30] ] `




go back go back