Vectors, Matrices, and Linear SystemsIntroduction and ContextMechatronic systems combine mechanical structures, electrical circuits, sensors, actuators, and computation. These subsystems are often described by quantities that have several components and by equations that must be solved simultaneously. A force may have horizontal and vertical components; a robot position may be represented in three-dimensional coordinates; a sensor may produce several related measurements; and a circuit may contain multiple unknown currents. Vectors and matrices provide a common mathematical language for these situations. A vector represents a quantity with components arranged in an ordered list. A matrix is a rectangular array that organizes numbers and describes linear transformations or systems of equations. A linear system expresses relationships among unknown quantities. Together, these ideas support force analysis, coordinate transformations, calibration, circuit analysis, state estimation, and numerical computation. This chapter develops the theory and practical methods needed to operate with vectors and matrices and to solve linear systems reliably. Learning ObjectivesBy the end of this chapter, you should be able to: - distinguish scalars, vectors, matrices, and linear systems;
- perform vector addition, scalar multiplication, dot products, and cross products;
- interpret vector magnitude, direction, projection, and orthogonality;
- perform matrix addition, multiplication, transposition, and inversion;
- formulate engineering problems as matrix equations;
- solve linear systems using elimination, determinants, inverses, and computational methods;
- identify unique, inconsistent, and underdetermined systems;
- assess conditioning, numerical error, and the limitations of computational solutions;
- apply these methods to forces, circuits, sensor calibration, transformations, and actuator relationships.
1. Scalars and VectorsA scalar has magnitude only. Examples include temperature, mass, resistance, time, and voltage. A vector has both magnitude and direction. Examples include force, velocity, acceleration, displacement, and torque. In a Cartesian coordinate system, a two-dimensional vector can be written as v = [vx, vy]T = vx i + vy j where vx and vy are the components along the x- and y-axes, i and j are unit vectors, and the superscript T denotes transpose. A three-dimensional vector is v = [vx, vy, vz]T The components must use a consistent coordinate system and units. For example, all components of a force vector must be measured in newtons. Magnitude and directionThe Euclidean magnitude, or norm, of a vector is ||v|| = √(vx² + vy²) for two dimensions, and ||v|| = √(vx² + vy² + vz²) for three dimensions. The formula assumes mutually perpendicular Cartesian axes. For a nonzero two-dimensional vector, its direction angle measured counterclockwise from the positive x-axis is θ = atan2(vy, vx) The two-argument function atan2 correctly identifies the quadrant. Using only tan⁻¹(vy/vx) can give an incorrect quadrant. A unit vector in the direction of v is u = v / ||v|| provided v ≠ 0. A unit vector has magnitude one and no physical unit when it represents direction. Vector operationsIf a = [a1,a2,a3]T and b = [b1,b2,b3]T, then addition and subtraction are componentwise: a ± b = [a1 ± b1, a2 ± b2, a3 ± b3]T Scalar multiplication is k a = [k a1, k a2, k a3]T where k is a scalar. Vector addition is meaningful only when vectors represent compatible quantities in the same coordinate system and units. Dot productThe dot product of two vectors is a scalar: a · b = a1b1 + a2b2 + a3b3 It also satisfies a · b = ||a|| ||b|| cos θ where θ is the angle between the vectors. Thus, cos θ = (a · b)/(||a|| ||b||) for nonzero vectors. If a · b = 0, the vectors are orthogonal. The scalar projection of a onto b is compb(a) = (a · b)/||b|| and the vector projection is projb(a) = ((a · b)/(b · b)) b provided b ≠ 0. In mechanics, the dot product gives work done by a constant force: W = F · d where F is force in newtons, d is displacement in metres, and W is work in joules. Cross productFor three-dimensional vectors, the cross product is a × b = [a2b3 − a3b2, a3b1 − a1b3, a1b2 − a2b1]T Its magnitude is ||a × b|| = ||a|| ||b|| sin θ and its direction is perpendicular to both vectors according to the right-hand rule. The cross product is not commutative: a × b = −(b × a). In mechanics, torque about a point is τ = r × F where r is the position vector from the reference point to the point of force application, F is force, and τ has units of newton-metres. Worked Example 1: Force components and torqueA force of 100 N acts at 30° above the positive x-axis. Its Cartesian representation is F = [100 cos 30°, 100 sin 30°]T = [86.60, 50.00]T N If it is applied at r = [0.20, 0.10, 0]T m, then τz = rxFy − ryFx Therefore, τz = (0.20)(50.00) − (0.10)(86.60) = 1.34 N·m The positive sign indicates a counterclockwise moment about the z-axis under the stated coordinate convention. 2. Matrices and Linear TransformationsA matrix is an array with rows and columns. An m × n matrix has m rows and n columns: A = [aij]_(m×n) The entry aij is located in row i and column j. A vector may be regarded as a one-column matrix. Important matrix types include: | Type | Definition or property |
|---|
| Row matrix | One row | | Column matrix | One column | | Square matrix | Equal numbers of rows and columns | | Zero matrix | Every entry is zero | | Identity matrix I | Square matrix with ones on the main diagonal and zeros elsewhere | | Diagonal matrix | All off-diagonal entries are zero | | Symmetric matrix | AT = A | | Singular matrix | A square matrix with no inverse | | |
Matrix addition and scalar multiplicationMatrices can be added or subtracted only when they have the same dimensions: (A ± B)ij = aij ± bij Scalar multiplication is (kA)ij = k aij Matrix multiplicationIf A is m × n and B is n × p, then AB exists and is m × p. Its entries are (AB)ij = ∑_(k=1)n aik bkj The inner dimensions must match. In general, matrix multiplication is not commutative: AB ≠ BA. Matrix multiplication represents composition of operations, so order is important. For a matrix A and vector x, the product Ax is a linear combination of the columns of A. This interpretation is central to modelling engineering systems. Transpose and inner productsThe transpose changes rows into columns: (AT)ij = aji For vectors, aTb is the dot product. A matrix may be partitioned into blocks, which can simplify large models and software implementation. Geometric transformationsA two-dimensional rotation through angle θ is represented by R(θ) = [cos θ −sin θ; sin θ cos θ] Thus, a point p expressed in one Cartesian frame becomes p' = R(θ)p in a rotated frame, subject to the convention that R actively rotates the vector counterclockwise. Different robotics texts use active and passive conventions; the convention must always be stated. A planar scaling transformation is S = [sx 0; 0 sy] where sx and sy are scale factors. Transformation matrices are widely used in robot kinematics, computer vision, CAD, and motion control. 3. Determinants and InversesThe determinant is defined for square matrices. For a 2 × 2 matrix, det(A) = |a b; c d| = ad − bc For a 3 × 3 matrix, expansion by the first row gives det(A) = a11(a22a33 − a23a32) − a12(a21a33 − a23a31) + a13(a21a32 − a22a31) The determinant measures signed scaling of area or volume under the associated linear transformation. A square matrix is invertible exactly when det(A) ≠ 0 For a 2 × 2 matrix, its inverse is A^−1 = 1/(ad − bc) [d −b; −c a] provided ad − bc ≠ 0. The identity relationships are AA^−1 = A^−1A = I. Although the inverse formula is useful for small systems and theory, explicitly computing an inverse is usually less efficient and can be less numerically stable than elimination or factorization for large systems. 4. Linear SystemsA system of m linear equations in n unknowns can be written as Ax = b where A is the coefficient matrix, x is the vector of unknowns, and b is the right-hand-side vector. A system is linear when each unknown appears only to the first power, is not multiplied by another unknown, and does not occur inside a nonlinear function. For example, 2x + y = 7 x − y = 1 has A = [2 1; 1 −1], x = [x; y], b = [7; 1] The augmented matrix is [A|b]. Elementary row operations preserve the solution set: - interchange two rows;
- multiply a row by a nonzero scalar;
- add a multiple of one row to another row.
Gaussian eliminationGaussian elimination transforms the augmented matrix into upper triangular or row-echelon form. Back-substitution then determines the unknowns. Partial pivoting exchanges rows to place a suitably large absolute pivot in the current diagonal position. This reduces the effect of round-off error. Worked Example 2: EliminationSolve 2x + y − z = 8 −3x − y + 2z = −11 −2x + y + 2z = −3 The augmented matrix is [2 1 −1 | 8; −3 −1 2 | −11; −2 1 2 | −3] Eliminating the first column produces [2 1 −1 | 8; 0 0 1 | 1; 0 2 1 | 5] Thus z = 1. The third row gives 2y + z = 5, so y = 2. The first row gives 2x + 2 − 1 = 8, hence x = 7/2. The solution is x = [3.5, 2, 1]T Substitution into all three original equations verifies the result: the left sides are respectively 8, −11, and −3. Rank and existence of solutionsThe rank of a matrix is the number of independent rows or columns. For Ax = b, - a unique solution exists if rank(A) = rank([A|b]) = n;
- infinitely many solutions exist if rank(A) = rank([A|b]) < n;
- no solution exists if rank(A) ≠ rank([A|b]).
A row such as [0 0 0 | c]] with c ≠ 0 represents the contradiction 0 = c and proves inconsistency. Solving with an inverseIf A is square and nonsingular, then Ax = b ⇒ x = A^−1b This method is conceptually direct but should generally not be implemented by explicitly calculating A^−1 when A is large. A numerical solver can factor A and solve the system more efficiently. Cramer's ruleFor a square system with det(A) ≠ 0, Cramer's rule gives xi = det(Ai)/det(A) where Ai is formed by replacing column i of A with b. This is useful for theoretical analysis and very small systems, but it is computationally inefficient for large systems. Worked Example 3: Inverse and determinantFor A = [3 1; 2 1], b = [9; 7] det(A) = 3(1) − 1(2) = 1, so the inverse exists: A^−1 = [1 −1; −2 3] Therefore, x = A^−1b = [1 −1; −2 3][9; 7] = [2; 3] The solution is x = 2 and y = 3. 5. Numerical and Computational MethodsEngineering software commonly solves systems using algorithms such as Gaussian elimination with pivoting, LU factorization, QR factorization, and iterative methods. LU factorizationFor many square matrices, a factorization has the form PA = LU where P is a permutation matrix, L is lower triangular, and U is upper triangular. To solve Ax = b, first solve Ly = Pb by forward substitution and then solve Ux = y by back-substitution. If the same matrix is used with several right-hand sides, factorization can be reused. QR factorization and least squaresWhen a system has more equations than unknowns, it may be impossible to satisfy every equation exactly because of measurement noise. For A with full column rank, the least-squares estimate minimizes the squared residual ||Ax − b||² and satisfies the normal equations AT A x = AT b In practical numerical work, QR factorization is generally preferred to forming ATA, because the latter can worsen conditioning. Least squares is fundamental in sensor calibration and parameter estimation. Conditioning and residualsA residual is r = b − A x̂ where x̂ is a computed solution. A small residual indicates that x̂ nearly satisfies the equations, but it does not always guarantee accurate unknowns if the system is ill-conditioned. The condition number in a chosen matrix norm is κ(A) = ||A|| ||A^−1|| for an invertible matrix. A large κ(A) means that small input or round-off errors may cause relatively large changes in the solution. Engineers should report tolerances, units, scaling, and residuals rather than accepting software output without checks. 6. Engineering ApplicationsForce and equilibrium modelsFor a rigid body in static equilibrium, the vector sums of forces and moments are zero: ∑F = 0, ∑τ = 0 Resolving these equations into coordinate components produces a linear system for unknown reaction forces, cable tensions, or actuator loads. The equations are valid under the assumptions of static equilibrium and a clearly defined free-body diagram. Circuit analysisKirchhoff’s current law states that algebraic current flow at a node sums to zero; Kirchhoff’s voltage law states that algebraic voltage changes around a closed loop sum to zero. With Ohm’s law, V = IR where V is voltage in volts, I is current in amperes, and R is resistance in ohms, a resistive network can be expressed as Ax = b. Sign conventions must be consistent. Sensor calibrationSuppose a sensor output y is approximated by a linear model y = c0 + c1 x where x is the reference input, c0 is offset, and c1 is sensitivity. With multiple measurements, write [1 x1; 1 x2; …; 1 xm][c0; c1] ≈ [y1; y2; …; ym] and estimate the coefficients by least squares. Calibration data should span the operating range, use traceable references where required, and be checked for bias, hysteresis, saturation, and temperature dependence. Actuator relationshipsA multi-actuator mechanism may be locally approximated by Δy = J Δu where Δu is a vector of small actuator changes, Δy is a vector of output changes, and J is a sensitivity or Jacobian matrix. This linearization is valid near the operating point and should not be assumed accurate over a large range or near singular configurations. 7. Applied Case: Calibration of a Two-Channel Force SensorThe following is an illustrative engineering case. BackgroundA small robotic gripper estimates applied force using two voltage channels. The desired model is [f1; f2] = C [v1; v2] + d where C is a 2 × 2 calibration matrix, d is an offset vector, voltages are measured in volts, and forces are measured in newtons. ProblemCross-sensitivity is present: channel 1 responds partly to force in direction 2, and channel 2 responds partly to force in direction 1. Independent single-channel scaling would therefore produce biased force estimates. Analysis and approachAt a particular operating point, an experiment provides the calibration relationship C = [2.0 0.2; 0.1 1.8] N/V, d = [0.10; −0.05] N For measured voltages v = [1.50; 2.00] V first calculate the offset-corrected contribution: Cv = [2.0(1.50) + 0.2(2.00); 0.1(1.50) + 1.8(2.00)] = [3.40; 3.75] N Adding the offset gives f = Cv + d = [3.50; 3.70] N The matrix model accounts for channel coupling. In practice, C could be estimated from many reference measurements using least squares. A validation data set should then be used to calculate residuals and maximum error. Outcome and learning pointsThe calibrated model converts raw measurements into engineering quantities while explicitly representing cross-coupling. The case demonstrates that matrix multiplication is not merely an abstract operation: it expresses how multiple inputs contribute simultaneously to multiple outputs. It also shows why calibration coefficients require units and why offsets must not be confused with gains. 8. Best Practices, Limitations, and Professional Responsibility- Define the coordinate system, sign convention, reference point, and units before forming equations.
- Check matrix dimensions before multiplying.
- Preserve extra digits during intermediate calculations and round only final reported values.
- Verify computed solutions by substitution and inspect the residual.
- Use pivoting or stable factorizations for numerical work.
- Avoid explicit matrix inversion for large computational problems unless there is a justified reason.
- Scale variables when their magnitudes differ greatly.
- Distinguish a mathematically exact model from a linear approximation based on measured data.
- Test calibration models outside the fitting data, but within safe and valid operating limits.
- Treat incorrect signs, units, or coordinate conventions as potential safety hazards in force and actuator calculations.
Software packages can perform elimination, factorization, and optimization rapidly, but they cannot determine whether a free-body diagram is correct, whether a sensor model is physically appropriate, or whether a result is safe to use. Engineers remain responsible for model selection, validation, documentation, and traceability. In safety-critical systems, numerical results should be supported by independent checks and appropriate engineering standards. Chapter SummaryVectors represent directed quantities and support component resolution, projections, work, and torque calculations. Their magnitudes, dot products, and cross products have direct geometric and physical interpretations. Matrices organize coefficients, represent linear transformations, and map input vectors to output vectors. Matrix multiplication requires compatible dimensions and is generally order-dependent. A linear system is written as Ax = b. Gaussian elimination uses elementary row operations and is a general practical solution method. Inverse matrices and Cramer’s rule provide useful theoretical and small-system methods, but numerical software normally uses pivoted elimination or matrix factorizations. Rank determines whether a system has a unique solution, infinitely many solutions, or no solution. Least-squares methods handle overdetermined systems and measurement noise. Residuals assess equation satisfaction, while condition numbers indicate sensitivity to errors. These concepts are essential in force equilibrium, circuit analysis, coordinate transformations, sensor calibration, and actuator modelling. Reliable engineering practice requires consistent units, explicit assumptions, validation, and awareness of numerical and physical limitations. Key TermsVector: An ordered quantity with magnitude and direction. Scalar: A quantity described by magnitude only. Component: The signed contribution of a vector along a coordinate axis. Norm: The magnitude or length of a vector. Unit vector: A vector with magnitude one. Dot product: A product of two vectors that produces a scalar. Cross product: A three-dimensional vector product perpendicular to both input vectors. Matrix: A rectangular array of numbers or symbols. Identity matrix: A square matrix that acts as the multiplicative identity. Transpose: The matrix obtained by interchanging rows and columns. Determinant: A scalar associated with a square matrix that indicates invertibility and signed scaling. Inverse matrix: A matrix that produces the identity when multiplied by the original matrix. Linear system: A set of simultaneous equations whose unknowns occur linearly. Augmented matrix: The coefficient matrix joined with the right-hand-side vector. Rank: The number of linearly independent rows or columns. Pivot: A selected entry used to eliminate other entries in a column. Residual: The difference between the right-hand side and a computed model output. Condition number: A measure of sensitivity of a matrix problem to perturbations. Least squares: A method that minimizes the sum of squared residuals. Jacobian: A matrix of first-order sensitivities of outputs to inputs. Review Questions5 Short Answer Questions- What is the difference between a scalar and a vector?
- Under what condition are two vectors orthogonal?
- What dimension must matrix B have for the product AB to exist when A is m × n?
- State the condition under which a square matrix has an inverse.
- What does a large condition number imply about a numerical linear system?
5 Long Answer Questions- Explain vector addition, scalar multiplication, dot products, and cross products, including one engineering application of each.
- Derive the inverse of a general 2 × 2 matrix and state the condition for its existence.
- Describe Gaussian elimination and explain why partial pivoting is useful.
- Compare elimination, inverse methods, and Cramer’s rule for solving linear systems.
- Explain how least squares can be used to calibrate a sensor and why validation data are necessary.
3 Analytical / Application Questions- A force vector is F = [40, −30, 20]T N. Calculate its magnitude and the work done through displacement d = [0.5, 0.2, 0]T m.
- Formulate a matrix equation for a three-loop resistive circuit using Kirchhoff’s laws. Clearly state the unknown currents, sign conventions, and resistance units.
- A robotic actuator has local relationship Δy = JΔu. Explain how a nearly singular J would affect control allocation and propose two engineering responses.
Multiple Choice Questions with AnswersQuestion 1Which expression gives the magnitude of the vector v = [3,4]T? A. 3 B. 4 C. 5 D. 7 Correct Answer: C. 5 Question 2If a · b = 0 for two nonzero vectors, what is true? A. They are parallel B. They are orthogonal C. They have equal magnitudes D. They point in the same direction Correct Answer: B. They are orthogonal Question 3For A of size 3 × 2 and B of size 2 × 4, what is the size of AB? A. 2 × 3 B. 3 × 4 C. 2 × 4 D. 3 × 2 Correct Answer: B. 3 × 4 Question 4What condition is necessary and sufficient for a square matrix A to be invertible? A. Every entry is positive B. det(A) = 0 C. det(A) ≠ 0 D. A is rectangular Correct Answer: C. det(A) ≠ 0 Question 5Which operation is not an allowed elementary row operation? A. Interchanging two rows B. Multiplying a row by a nonzero scalar C. Adding a multiple of one row to another D. Multiplying two rows entry by entry Correct Answer: D. Multiplying two rows entry by entry Question 6Solve the system x + y = 5 and x − y = 1. What is x? A. 1 B. 2 C. 3 D. 4 Correct Answer: C. 3 Question 7A row [0,0,0|4] in an augmented matrix represents which situation? A. A unique solution B. An identity equation C. No solution D. Three free variables Correct Answer: C. No solution Question 8In the equation τ = r × F, what physical quantity does τ represent? A. Power B. Torque C. Linear momentum D. Work Correct Answer: B. Torque Question 9What quantity is minimized in a standard least-squares fit? A. The largest input value B. The determinant of the coefficient matrix C. The sum of squared residuals D. The number of equations Correct Answer: C. The sum of squared residuals Question 10A large condition number generally indicates that the computed solution is: A. Insensitive to measurement errors B. Highly sensitive to small perturbations C. Guaranteed to be exact D. Independent of matrix scaling Correct Answer: B. Highly sensitive to small perturbations
|