Linear Algebra for AI

Chapter 1
Mathematical Language, Scalars, Vectors and Matrices

Bachelors Program in AI & ML
Linear Algebra for AI   •   Bachelor

Mathematical Language, Scalars, Vectors and Matrices

Introduction

Linear algebra is the mathematical language used to represent data, transformations, constraints, and models in artificial intelligence and machine learning. A grayscale image can be represented as a matrix of pixel intensities; a document can be represented as a vector of word or embedding features; and the parameters of a neural network can be organized into vectors, matrices, and higher-dimensional arrays. Understanding the underlying language is therefore essential before studying regression, optimization, neural networks, computer vision, natural-language processing, or reinforcement learning.

This chapter develops the basic mathematical objects used throughout linear algebra: sets, fields, scalars, vectors, and matrices. It also introduces notation, indices, summation, transpose operations, norms, distances, and elementary proof techniques. The focus is not merely on manipulating symbols, but on interpreting these objects and understanding the assumptions under which operations are valid.

Learning Objectives

By the end of this chapter, you should be able to:

1. Explain sets, subsets, Cartesian products, and fields.

2. Distinguish real and complex scalars and use appropriate notation.

3. Interpret vector and matrix dimensions and indices.

4. Perform vector and matrix addition, scalar multiplication, and matrix multiplication.

5. Use transpose and conjugate transpose correctly.

6. Calculate common vector norms and distances.

7. Apply summation notation to compactly express computations.

8. Use direct proof, proof by contradiction, and counterexamples in elementary linear algebra.

9. Interpret these concepts in AI and machine-learning applications.

1. Mathematical Language: Sets, Symbols, and Structure

1.1 Sets and membership

A set is a collection of distinct objects. The objects are called elements or members of the set. Sets are commonly written using braces. For example,

\[

A=\{1,2,3\}

\]

means that 1, 2, and 3 belong to set \(A\). The notation \(x\in A\) means “\(x\) is an element of \(A\),” while \(x\notin A\) means that it is not.

A set can be described by listing its elements or by specifying a property:

\[

B=\{x\in\mathbb{R}: x>0\}.

\]

This denotes the set of positive real numbers. The colon means “such that.” The empty set, containing no elements, is written \(\varnothing\).

If every element of \(A\) also belongs to \(B\), then \(A\) is a subset of \(B\), written \(A\subseteq B\). If \(A\subseteq B\) and \(A\neq B\), then \(A\) is a proper subset, written \(A\subset B\).

Important set operations include:

  • Union: \(A\cup B\) contains elements in \(A\), in \(B\), or in both.
  • Intersection: \(A\cap B\) contains elements common to both sets.
  • Difference: \(A\setminus B\) contains elements in \(A\) but not in \(B\).
  • Cartesian product: \(A\times B=\{(a,b):a\in A,b\in B\}\).

The Cartesian product is important because an \(m\)-dimensional real vector is an element of \(\mathbb{R}^m\), which is the product of \(m\) copies of \(\mathbb{R}\).

1.2 Number systems and fields

The principal number systems used in introductory linear algebra are:

  • \(\mathbb{N}\): natural numbers, with conventions varying on whether 0 is included.
  • \(\mathbb{Z}\): integers.
  • \(\mathbb{Q}\): rational numbers.
  • \(\mathbb{R}\): real numbers.
  • \(\mathbb{C}\): complex numbers.

A field is a set equipped with addition and multiplication satisfying familiar arithmetic properties. In particular, addition and multiplication are associative and commutative, multiplication distributes over addition, additive and multiplicative identities exist, and every element has an additive inverse while every nonzero element has a multiplicative inverse.

The real numbers form a field, as do the complex numbers. The integers do not form a field because, for example, the multiplicative inverse of 2, namely \(1/2\), is not an integer.

A vector space is defined over a field. Most machine-learning models use real vector spaces such as \(\mathbb{R}^n\), but complex vector spaces are important in signal processing, quantum information, Fourier analysis, and some engineering applications.

1.3 Scalars

A scalar is a single element of the underlying field. In a real vector space, a scalar is a real number. Scalars are usually written using lowercase italic letters such as \(a\), \(b\), or \(\lambda\). Scalar multiplication changes the magnitude of a vector and, in some settings, its direction.

A complex scalar has the form

\[

z=a+bi,

\]

where \(a,b\in\mathbb{R}\) and \(i^2=-1\). The real part is \(\operatorname{Re}(z)=a\), and the imaginary part is \(\operatorname{Im}(z)=b\). Its complex conjugate is

\[

\overline{z}=a-bi,

\]

and its magnitude is

\[

|z|=\sqrt{a^2+b^2}.

\]

For real numbers, conjugation has no effect: \(\overline{x}=x\).

2. Notation, Indices, and Summation

Clear notation prevents many errors in linear algebra. A scalar is often represented by a lowercase letter, a vector by a bold lowercase letter, and a matrix by a bold uppercase letter. For example,

\[

a\in\mathbb{R},\qquad \mathbf{x}\in\mathbb{R}^n,\qquad A\in\mathbb{R}^{m\times n}.

\]

The notation \(A\in\mathbb{R}^{m\times n}\) means that \(A\) has \(m\) rows and \(n\) columns, with every entry real.

A vector may be written as a column:

\[

\mathbf{x}=\begin{bmatrix}x_1\\x_2\\\vdots\\x_n\end{bmatrix}.

\]

The subscript identifies the component. In general, \(x_i\) denotes the \(i\)-th component, where \(1\leq i\leq n\). A matrix is written

\[

A=\begin{bmatrix}

a_{11}&a_{12}&\cdots&a_{1n}\\

a_{21}&a_{22}&\cdots&a_{2n}\\

\vdots&\vdots&\ddots&\vdots\\

a_{m1}&a_{m2}&\cdots&a_{mn}

\end{bmatrix}.

\]

Here, \(a_{ij}\) is the entry in row \(i\), column \(j\). Unless stated otherwise, mathematical indices begin at 1. In programming, indices often begin at 0; translating between these conventions is a practical source of implementation errors.

2.1 Summation notation

The expression

\[

\sum_{i=1}^{n}x_i

\]

means \(x_1+x_2+\cdots+x_n\). A double sum is useful for matrices:

\[

\sum_{i=1}^{m}\sum_{j=1}^{n}a_{ij}.

\]

For example, if \(\mathbf{x},\mathbf{y}\in\mathbb{R}^n\), their dot product is

\[

\mathbf{x}^{\mathsf T}\mathbf{y}=\sum_{i=1}^{n}x_i y_i.

\]

The symbol \(\mathsf T\) denotes transpose. Summation notation is compact, but it does not remove the need to check dimensions and index ranges.

3. Vectors and Vector Operations

3.1 Geometric and data interpretations

A vector in \(\mathbb{R}^n\) is an ordered list of \(n\) real numbers. In two or three dimensions it can be visualized as a directed arrow. In machine learning, however, a vector usually represents a point or an ordered feature list rather than a physical arrow.

For example, a customer may be represented by

\[

\mathbf{x}=\begin{bmatrix}35\\52000\\4\end{bmatrix},

\]

where the components might represent age, annual income, and number of previous purchases. The components need not have the same units, which is why feature scaling often matters in practice.

3.2 Addition and scalar multiplication

If \(\mathbf{x},\mathbf{y}\in\mathbb{R}^n\), their sum is defined componentwise:

\[

\mathbf{x}+\mathbf{y}=\begin{bmatrix}x_1+y_1\\\vdots\\x_n+y_n\end{bmatrix}.

\]

For a scalar \(\alpha\in\mathbb{R}\),

\[

\alpha\mathbf{x}=\begin{bmatrix}\alpha x_1\\\vdots\\\alpha x_n\end{bmatrix}.

\]

These operations are defined only for vectors of the same dimension. The vector \(-\mathbf{x}\) is the additive inverse of \(\mathbf{x}\), and \(\mathbf{x}-\mathbf{y}\) means \(\mathbf{x}+(-\mathbf{y})\).

3.3 Dot product

For \(\mathbf{x},\mathbf{y}\in\mathbb{R}^n\), the dot product is

\[

\mathbf{x}^{\mathsf T}\mathbf{y}=\sum_{i=1}^{n}x_i y_i.

\]

It is a scalar. The dot product measures alignment: it is positive when vectors point generally in similar directions, zero when they are orthogonal, and negative when they point generally in opposite directions. The cosine similarity, provided both vectors are nonzero, is

\[

\cos\theta=\frac{\mathbf{x}^{\mathsf T}\mathbf{y}}{\|\mathbf{x}\|_2\|\mathbf{y}\|_2}.

\]

This quantity is widely used in information retrieval and embedding comparison.

Worked Example 1: Vector operations

Let

\[

\mathbf{x}=\begin{bmatrix}1\\-2\\3\end{bmatrix},\qquad

\mathbf{y}=\begin{bmatrix}4\\0\\-1\end{bmatrix}.

\]

Then

\[

\mathbf{x}+\mathbf{y}=\begin{bmatrix}5\\-2\\2\end{bmatrix},

\qquad

2\mathbf{x}=\begin{bmatrix}2\\-4\\6\end{bmatrix}.

\]

The dot product is

\[

\mathbf{x}^{\mathsf T}\mathbf{y}=1(4)+(-2)(0)+3(-1)=1.

\]

The vectors are not orthogonal because their dot product is not zero.

4. Matrices and Matrix Operations

A matrix is a rectangular array of scalars. A matrix can represent a dataset, a linear transformation, a system of equations, or model parameters.

4.1 Equality and addition

Two matrices are equal only if they have the same dimensions and corresponding entries are equal. Matrices of the same dimensions can be added componentwise:

\[

(A+B)_{ij}=a_{ij}+b_{ij}.

\]

Scalar multiplication is also componentwise:

\[

(\alpha A)_{ij}=\alpha a_{ij}.

\]

4.2 Matrix–vector multiplication

If \(A\in\mathbb{R}^{m\times n}\) and \(\mathbf{x}\in\mathbb{R}^{n}\), then \(A\mathbf{x}\in\mathbb{R}^{m}\). Its \(i\)-th component is

\[

(A\mathbf{x})_i=\sum_{j=1}^{n}a_{ij}x_j.

\]

The inner dimensions must match: the number of columns of \(A\) must equal the number of components of \(\mathbf{x}\).

4.3 Matrix multiplication

If \(A\in\mathbb{R}^{m\times n}\) and \(B\in\mathbb{R}^{n\times p}\), their product \(AB\) is an \(m\times p\) matrix with entries

\[

(AB)_{ij}=\sum_{k=1}^{n}a_{ik}b_{kj}.

\]

Matrix multiplication is associative and distributive:

\[

(AB)C=A(BC),\qquad A(B+C)=AB+AC,

\]

whenever the dimensions permit the expressions. It is generally not commutative: usually \(AB\neq BA\), and one of the products may not even be defined.

Worked Example 2: Matrix–vector multiplication

Let

\[

A=\begin{bmatrix}2&1\\-1&3\end{bmatrix},\qquad

\mathbf{x}=\begin{bmatrix}4\\2\end{bmatrix}.

\]

Then

\[

A\mathbf{x}=\begin{bmatrix}2(4)+1(2)\\-1(4)+3(2)\end{bmatrix}

=\begin{bmatrix}10\\2\end{bmatrix}.

\]

The first row of \(A\) combines the input features with weights 2 and 1; the second row combines them with weights -1 and 3. This is the basic computation performed by a fully connected neural-network layer before an activation function is applied.

4.4 Special matrices

Several matrices occur frequently:

  • A square matrix has the same number of rows and columns.
  • A diagonal matrix has zero entries outside its main diagonal.
  • The identity matrix \(I_n\) has ones on the main diagonal and zeros elsewhere; \(I_n\mathbf{x}=\mathbf{x}\).
  • A zero matrix has every entry equal to zero.
  • A symmetric real matrix satisfies \(A^{\mathsf T}=A\).

The identity matrix is the multiplicative identity for compatible square matrices, but not every nonzero square matrix has an inverse. Invertibility is discussed in later linear algebra chapters and should not be assumed merely because a matrix is square.

5. Transpose and Conjugate Transpose

The transpose of \(A\in\mathbb{R}^{m\times n}\), denoted \(A^{\mathsf T}\), is the \(n\times m\) matrix obtained by interchanging rows and columns:

\[

(A^{\mathsf T})_{ij}=a_{ji}.

\]

For a vector, transposition changes a row vector into a column vector and vice versa. Important identities are

\[

(A+B)^{\mathsf T}=A^{\mathsf T}+B^{\mathsf T},

\qquad

(AB)^{\mathsf T}=B^{\mathsf T}A^{\mathsf T}.

\]

The reversal of order in the second identity is essential.

For a complex matrix \(A\), the conjugate transpose, or Hermitian transpose, is denoted \(A^{\mathsf H}\) and defined by

\[

A^{\mathsf H}=\overline{A}^{\mathsf T}.

\]

Thus, transpose and complex conjugation are both applied. A complex matrix is Hermitian if \(A^{\mathsf H}=A\). In real-valued problems, \(A^{\mathsf H}=A^{\mathsf T}\).

For complex vectors, the appropriate inner product is

\[

\mathbf{x}^{\mathsf H}\mathbf{y}=\sum_{i=1}^{n}\overline{x_i}y_i.

\]

Using an ordinary transpose instead of a conjugate transpose in a complex inner product can produce incorrect results, including a non-real squared length.

6. Norms and Distances

A norm is a function that measures the size of a vector. A norm must satisfy, for all vectors \(\mathbf{x},\mathbf{y}\) and scalars \(\alpha\):

1. Non-negativity: \(\|\mathbf{x}\|\geq 0\).

2. Definiteness: \(\|\mathbf{x}\|=0\) if and only if \(\mathbf{x}=\mathbf{0}\).

3. Absolute homogeneity: \(\|\alpha\mathbf{x}\|=|\alpha|\|\mathbf{x}\|\).

4. Triangle inequality: \(\|\mathbf{x}+\mathbf{y}\|\leq\|\mathbf{x}\|+\|\mathbf{y}\|\).

6.1 Common vector norms

The Euclidean or \(\ell_2\) norm is

\[

\|\mathbf{x}\|_2=\sqrt{\sum_{i=1}^{n}|x_i|^2}.

\]

For real vectors this is the usual geometric length. The squared Euclidean norm is

\[

\|\mathbf{x}\|_2^2=\mathbf{x}^{\mathsf T}\mathbf{x}

\]

in the real case, or \(\mathbf{x}^{\mathsf H}\mathbf{x}\) in the complex case.

The \(\ell_1\) norm is

\[

\|\mathbf{x}\|_1=\sum_{i=1}^{n}|x_i|,

\]

and the infinity norm is

\[

\|\mathbf{x}\|_\infty=\max_i |x_i|.

\]

More generally, for \(p\geq1\),

\[

\|\mathbf{x}\|_p=\left(\sum_{i=1}^{n}|x_i|^p\right)^{1/p}.

\]

The restriction \(p\geq1\) is important: for \(0<p<1\), the same expression is not a norm because the triangle inequality fails in general.

6.2 Distances

The distance induced by a norm is the norm of the difference:

\[

d(\mathbf{x},\mathbf{y})=\|\mathbf{x}-\mathbf{y}\|.

\]

The Euclidean distance is common in clustering and nearest-neighbor methods. The Manhattan distance is the \(\ell_1\) distance. The choice of distance affects model behavior and should reflect the data and application.

Worked Example 3: Norms and distance

Let \(\mathbf{x}=\begin{bmatrix}3\\-4\end{bmatrix}\). Then

\[

\|\mathbf{x}\|_2=\sqrt{3^2+(-4)^2}=5,

\]

\[

\|\mathbf{x}\|_1=|3|+|-4|=7,

\qquad

\|\mathbf{x}\|_\infty=4.

\]

For \(\mathbf{y}=\begin{bmatrix}1\\-1\end{bmatrix}\),

\[

\mathbf{x}-\mathbf{y}=\begin{bmatrix}2\\-3\end{bmatrix},

\]

so the Euclidean distance is \(\sqrt{2^2+(-3)^2}=\sqrt{13}\), while the Manhattan distance is \(2+3=5\).

6.3 Why norms matter in AI

Norms are used to measure prediction error, regularize model parameters, compare embeddings, detect anomalies, and define stopping criteria for optimization. For example, an objective may include an \(\ell_2\) penalty \(\lambda\|\mathbf{w}\|_2^2\), where \(\lambda\geq0\) controls the trade-off between fitting data and keeping parameters small. An \(\ell_1\) penalty can encourage sparse parameter vectors, although the consequences depend on the complete optimization problem and feature scaling.

7. Elementary Proof Techniques

Mathematical reasoning is central to reliable AI systems. Proofs establish that definitions and algorithms behave as claimed.

7.1 Direct proof

To prove an implication “if \(P\), then \(Q\),” assume \(P\) and derive \(Q\). For example, if \(\mathbf{x}=\mathbf{0}\), then

\[

\|\mathbf{x}\|_2=\sqrt{\sum_i 0^2}=0.

\]

This establishes one direction of norm definiteness.

7.2 Proof by contradiction

To prove a statement, assume it is false and show that this assumption leads to an impossibility. This technique is useful when direct construction is inconvenient.

7.3 Counterexample

A universal claim is disproved by one valid counterexample. The claim “matrix multiplication is commutative” is false. Let

\[

A=\begin{bmatrix}1&0\\0&0\end{bmatrix},\qquad

B=\begin{bmatrix}0&1\\0&0\end{bmatrix}.

\]

Then

\[

AB=\begin{bmatrix}0&1\\0&0\end{bmatrix},

\qquad

BA=\begin{bmatrix}0&0\\0&0\end{bmatrix},

\]

so \(AB\neq BA\). A counterexample is not a proof that a statement is true; it is a proof that a universal statement is false.

7.4 Induction and dimensional checking

Induction is useful for statements indexed by a positive integer, such as identities involving \(n\) components. Dimensional checking is not a formal proof of every claim, but it is an efficient way to detect invalid operations. For instance, if \(A\) is \(3\times2\), then \(A\mathbf{x}\) requires \(\mathbf{x}\in\mathbb{R}^2\), and the result lies in \(\mathbb{R}^3\).

8. Applied Case: Embedding-Based Document Retrieval

The following is an illustrative case.

Background

A university wants to retrieve documents relevant to a student’s question. Each document and query is represented by a vector in \(\mathbb{R}^d\), produced by an embedding model.

Problem

Documents may differ in length, and raw dot products can favor vectors with larger magnitudes. The system therefore needs a similarity measure that emphasizes direction rather than magnitude.

Analysis and approach

Let a query embedding be \(\mathbf{q}\) and a document embedding be \(\mathbf{d}\), both nonzero. The system computes cosine similarity:

\[

\operatorname{sim}(\mathbf{q},\mathbf{d})=

\frac{\mathbf{q}^{\mathsf T}\mathbf{d}}

{\|\mathbf{q}\|_2\|\mathbf{d}\|_2}.

\]

The numerator is a dot product, and the denominator normalizes both vectors. If the embeddings are normalized in advance, so that each has Euclidean norm 1, the cosine similarity reduces to the dot product.

Suppose

\[

\mathbf{q}=\begin{bmatrix}1\\2\end{bmatrix},\quad

\mathbf{d}_1=\begin{bmatrix}2\\1\end{bmatrix},\quad

\mathbf{d}_2=\begin{bmatrix}-1\\2\end{bmatrix}.

\]

Then

\[

\mathbf{q}^{\mathsf T}\mathbf{d}_1=4,

\quad \|\mathbf{q}\|_2=\sqrt5,

\quad \|\mathbf{d}_1\|_2=\sqrt5,

\]

so \(\operatorname{sim}(\mathbf{q},\mathbf{d}_1)=4/5=0.8\). Also,

\[

\mathbf{q}^{\mathsf T}\mathbf{d}_2=3,

\quad \|\mathbf{d}_2\|_2=\sqrt5,

\]

so \(\operatorname{sim}(\mathbf{q},\mathbf{d}_2)=3/5=0.6\). The first document is ranked higher under this measure.

Outcome and learning points

The case demonstrates how vectors, dot products, norms, and distances combine in a real AI pipeline. It also illustrates an important limitation: similarity quality depends on the embedding model, training data, normalization choices, and domain. A mathematically valid similarity measure does not guarantee fair or relevant retrieval.

9. Challenges, Limitations, and Best Practices

9.1 Scaling and units

A distance computed from features measured in incompatible scales can be misleading. Income measured in thousands and age measured in years contribute differently from the same numerical ranges. Standardization, normalization, or domain-specific weighting may be necessary, but these choices should be documented and fitted without leaking information from a test set.

9.2 Numerical precision

Computers use finite-precision arithmetic. Very large or very small values can cause overflow, underflow, or loss of significance. Equality tests involving floating-point results should generally use a tolerance appropriate to the scale and conditioning of the computation.

9.3 Sparse and high-dimensional data

Vectors in text processing may have millions of possible coordinates but relatively few nonzero entries. Sparse representations can reduce memory and computation. In high dimensions, distances may become less discriminative, making representation learning, dimensionality reduction, or alternative similarity measures useful.

9.4 Reproducibility and governance

AI practitioners should record dimensions, data types, scaling procedures, indexing conventions, and normalization choices. Incorrectly transposing a matrix or confusing row-major and column-major conventions can silently produce wrong results. In consequential applications, validation must include subgroup performance, data provenance, and the consequences of similarity or distance errors.

9.5 Contemporary developments

Modern AI increasingly uses large vector embeddings, approximate nearest-neighbor search, tensor libraries, automatic differentiation, and accelerator hardware. These systems extend the same mathematical foundations rather than replacing them. Understanding the dimensions and algebra of an operation remains essential when debugging model architectures, optimizing memory, or interpreting outputs.

Chapter Summary

Linear algebra provides the formal language for representing data and transformations in AI. Sets describe collections and domains, while fields provide the scalar arithmetic used in vector spaces. Real and complex scalars have different conjugation rules. Vectors are ordered collections of scalars, and matrices are rectangular arrays whose dimensions determine which operations are valid.

Vector addition, scalar multiplication, dot products, matrix–vector multiplication, and matrix multiplication are fundamental operations. Transpose interchanges rows and columns; conjugate transpose additionally takes complex conjugates. Norms measure vector size, and norm-induced distances measure separation between data points. The \(\ell_1\), \(\ell_2\), and infinity norms have distinct computational and modeling consequences.

Summation and index notation make algorithms precise and compact. Direct proofs, contradiction, counterexamples, induction, and dimensional checks support reliable reasoning. In AI, these concepts underpin embeddings, similarity search, neural-network layers, regularization, optimization, and data representation. Correct dimensions, appropriate scaling, numerical awareness, and transparent documentation are essential professional practices.

Key Terms

Scalar: A single element of the underlying number field.

Set: A collection of distinct objects.

Subset: A set whose elements all belong to another set.

Field: A number system supporting addition, subtraction, multiplication, and division by nonzero elements.

Real number: A number belonging to \(\mathbb{R}\).

Complex number: A number of the form \(a+bi\), where \(a,b\in\mathbb{R}\).

Vector: An ordered list of scalars.

Dimension: The number of components in a vector or the size of a relevant vector space.

Matrix: A rectangular array of scalars.

Index: A symbol identifying a component, row, or column.

Dot product: The scalar sum of pairwise products of two equal-length vectors.

Matrix multiplication: An operation whose entries are row–column dot products.

Transpose: The operation that exchanges rows and columns.

Conjugate transpose: The transpose combined with complex conjugation.

Norm: A function measuring vector size and satisfying norm axioms.

Euclidean norm: The \(\ell_2\) norm.

Distance: A measure of separation, often defined as the norm of a difference.

Cosine similarity: Normalized dot product between two nonzero vectors.

Counterexample: One valid example that disproves a universal claim.

Regularization: Adding a penalty to an objective to control model parameters or complexity.

Review Questions

Short Answer Questions

1. What is the difference between a scalar, a vector, and a matrix?

2. Under what condition is the matrix product \(AB\) defined?

3. Define the transpose of a matrix.

4. What is the \(\ell_1\) norm of a vector?

5. Why is conjugate transpose needed for complex vectors?

Long Answer Questions

1. Explain real and complex fields and discuss why complex conjugation matters in inner products.

2. Describe matrix–vector multiplication using both component notation and an AI example.

3. Compare the \(\ell_1\), \(\ell_2\), and infinity norms, including one practical use of each.

4. Explain why matrix multiplication is generally noncommutative and provide a counterexample.

5. Discuss how feature scaling and numerical precision can affect distance-based machine-learning methods.

Analytical / Application Questions

1. Given \(\mathbf{x}=(2,-1,3)^{\mathsf T}\) and \(\mathbf{y}=(1,4,-2)^{\mathsf T}\), calculate their dot product, Euclidean distance, and cosine similarity.

2. A neural-network layer uses a weight matrix of dimension \(5\times 3\) and an input vector with three components. Determine the output dimension and explain what would happen if the input had four components.

3. Design a document-retrieval procedure using vector embeddings, cosine similarity, normalization, and a validation step. Identify one technical limitation and one governance concern.

Multiple Choice Questions with Answers

Question 1

Which set is a field?

A. The integers \(\mathbb{Z}\)

B. The real numbers \(\mathbb{R}\)

C. The natural numbers only

D. The set of even integers

Correct Answer: B. The real numbers \(\mathbb{R}\)

Question 2

If \(A\) has dimensions \(3\times 4\), which vector can be multiplied by \(A\) on the right?

A. A vector in \(\mathbb{R}^2\)

B. A vector in \(\mathbb{R}^3\)

C. A vector in \(\mathbb{R}^4\)

D. A vector in \(\mathbb{R}^5\)

Correct Answer: C. A vector in \(\mathbb{R}^4\)

Question 3

For \(\mathbf{x}=(1,-2,2)^{\mathsf T}\), what is \(\|\mathbf{x}\|_2\)?

A. \(3\)

B. \(\sqrt{5}\)

C. \(\sqrt{9}\)

D. \(5\)

Correct Answer: A. \(3\)

Question 4

What is the \(\ell_1\) norm of \((-3,4,-1)^{\mathsf T}\)?

A. 0

B. 4

C. 7

D. 8

Correct Answer: D. 8

Question 5

If \(A\in\mathbb{R}^{m\times n}\) and \(B\in\mathbb{R}^{n\times p}\), what are the dimensions of \(AB\)?

A. \(m\times p\)

B. \(n\times n\)

C. \(p\times m\)

D. \(m\times n\)

Correct Answer: A. \(m\times p\)

Question 6

Which identity is correct?

A. \((AB)^{\mathsf T}=A^{\mathsf T}B^{\mathsf T}\)

B. \((AB)^{\mathsf T}=B^{\mathsf T}A^{\mathsf T}\)

C. \((AB)^{\mathsf T}=AB\) for all matrices

D. \((AB)^{\mathsf T}=B A\) for all matrices

Correct Answer: B. \((AB)^{\mathsf T}=B^{\mathsf T}A^{\mathsf T}\)

Question 7

For real vectors, when are two vectors orthogonal?

A. Their norms are equal

B. Their dot product is zero

C. Their components are all positive

D. Their Euclidean distance is zero

Correct Answer: B. Their dot product is zero

Question 8

What is the main purpose of a counterexample?

A. To prove every statement is true

B. To calculate a matrix inverse

C. To disprove a universal claim

D. To define a field

Correct Answer: C. To disprove a universal claim

Question 9

If \(\mathbf{q}=(1,2)^{\mathsf T}\) and \(\mathbf{d}=(2,1)^{\mathsf T}\), their cosine similarity is

A. \(0.2\)

B. \(0.5\)

C. \(0.8\)

D. \(1.0\)

Correct Answer: C. \(0.8\)

Question 10

For a complex matrix, the conjugate transpose is obtained by

A. Multiplying every entry by -1

B. Transposing only

C. Taking complex conjugates only

D. Taking complex conjugates and then transposing

Correct Answer: D. Taking complex conjugates and then transposing

Linear Algebra for AI
Chapter 1 of 15