← Back to Blog

Vectors: Basic Operations

math > linear-algebra

2025-09-192 min read

#linear-algebra #math #vectors

This blog is based on Jong-han Kim's Linear Algebra

Block Vectors

a=[bcd]\mathbf{a} = \begin{bmatrix} b \\ c \\ d \end{bmatrix}

Zero, ones, and unit vectors

e.g., 길이가 33인 단위벡터

e1=[100]e2=[010]e3=[001]\mathbf{e}_1 = \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix} \quad \mathbf{e}_2 = \begin{bmatrix} 0 \\ 1 \\ 0 \end{bmatrix} \quad \mathbf{e}_3 = \begin{bmatrix} 0 \\ 0 \\ 1 \end{bmatrix}

Sparsity

벡터에 00으로 채워진 경우가 많다. 이를 효율적으로 계산할 수 있음.
mnz(x)\mathbf{mnz}(x): non-zero인 값의 수

e.g., zero vector, unit vector


Properties of vector addition


Scaler-vector multiplication

scalar β\beta, n-vector a\mathbf{a}

βa=(βa1,,βan)\beta \mathbf{a} = (\beta \mathbf{a}_1, \dots, \beta \mathbf{a}_n)

e.g.,

(2)[196]=[21812](-2) \begin{bmatrix} 1 \\ 9 \\ 6 \end{bmatrix} = \begin{bmatrix} -2 \\ -18 \\ -12 \end{bmatrix}

Properties of scalar-vector multiplication


Linear combinations

vectors a1,,am\mathbf{a}_1, \dots, \mathbf{a}_m, scalars β1,,βm\beta_1, \dots,\beta_m 의 linear combination은 β1a1++βmam\beta_1\mathbf{a}_1 + \dots + \beta_m\mathbf{a}_m 이다.

e.g., for any n-vector b\mathbf{b}

b=b1e1++bnen\mathbf{b} = \mathbf{b}_1\mathbf{e}_1 + \dots + \mathbf{b}_n\mathbf{e}_n

Linear product

Inner product (or dot product) of n-vectors a\mathbf{a} and b\mathbf{b} is

aTb=a1b1++anbn\mathbf{a}^T\mathbf{b} = \mathbf{a}_1\mathbf{b}_1 + \dots + \mathbf{a}_n\mathbf{b}_n

다른 notation: <a,b>, <ab>, (a,b), ab<a, b>,\ <a \vert b>,\ (a, b),\ a \cdot b

e.g.,

[122]T[103]=(1)(1)+(2)(0)+(2)(3)=7\begin{bmatrix} -1 \\2 \\2 \end{bmatrix}^T \begin{bmatrix} 1 \\0 \\-3 \end{bmatrix} = (-1)(1) + (2)(0) + (2)(-3) = -7

Properties of inner product

e.g.,

(a+b)T(c+d)=aTc+aTd+bTc+bTd(\mathbf{a}+\mathbf{b})^T (\mathbf{c}+\mathbf{d}) = \mathbf{a}^T\mathbf{c}+\mathbf{a}^T\mathbf{d}+\mathbf{b}^T\mathbf{c}+\mathbf{b}^T\mathbf{d}

중요 예시

행렬에서 자주 사용하는 수식이다.

eiTa=ai(picks out ith entry)\mathbf{e}^T_i\mathbf{a} = \mathbf{a}_i \quad \text{(picks out ith entry)} 1Ta=a1++an(sum of entries)\mathbf{1}^T\mathbf{a} = \mathbf{a}_1 + \dots + \mathbf{a}_n \quad \text{(sum of entries)} aTa=ai2++an2(sum of squares of enties)\mathbf{a}^T\mathbf{a} = \mathbf{a}^2_i + \dots + \mathbf{a}^2_n \quad \text{(sum of squares of enties)}