Chapter 8: State-Space Modeling

Lesson 4: State Transformations and Equivalence of Representations

This lesson formalizes when two state-space models represent the same underlying input–output dynamics. We develop similarity (state-coordinate) transformations, prove invariance of key system properties (transfer function, poles/eigenvalues, controllability/observability ranks), and provide constructive methods to compute a transformation matrix that maps one realization to another. Implementation workflows in Python, C++, Java, MATLAB/Simulink, and Wolfram Mathematica are included.

1. Conceptual Overview: Why Transform the State?

A state-space model (continuous-time) is written as \( \dot{\mathbf{x}}(t)=\mathbf{A}\mathbf{x}(t)+\mathbf{B}\mathbf{u}(t) \), \( \mathbf{y}(t)=\mathbf{C}\mathbf{x}(t)+\mathbf{D}\mathbf{u}(t) \), with \( \mathbf{x}(t)\in\mathbb{R}^n \). The state \( \mathbf{x}(t) \) is not unique: different choices of coordinates can represent the same internal “information” needed to predict future behavior.

In practice, we transform state coordinates to:

  • obtain a desired canonical form (controllable/observable/diagonal) introduced in Lesson 3,
  • improve numerical conditioning (scaling/balancing),
  • connect different modeling pipelines (physics-based vs. canonical realizations),
  • prove two models are equivalent (same input–output map) even if matrices differ.
flowchart TD
  P["Physical laws / ODEs"] --> M["Choose states x(t)"]
  M --> S1["State-space (A,B,C,D)"]
  S1 --> T["Pick invertible T (change of coordinates)"]
  T --> S2["Transformed (Abar,Bbar,Cbar,D)"]
  S2 --> IO["Same input-output behavior"]
  S2 --> F["Choose form: controllable / observable / diagonal"]
        

2. Similarity Transformations in Continuous and Discrete Time

Let \( \mathbf{T}\in\mathbb{R}^{n\times n} \) be invertible and define a new state coordinate \( \mathbf{z}(t) \) by \( \mathbf{x}(t)=\mathbf{T}\mathbf{z}(t) \). This is a change of basis in the state space.

2.1 Continuous-time derivation

Differentiate \( \mathbf{x}(t)=\mathbf{T}\mathbf{z}(t) \) (with constant \( \mathbf{T} \)): \( \dot{\mathbf{x}}(t)=\mathbf{T}\dot{\mathbf{z}}(t) \). Substitute into \( \dot{\mathbf{x}}=\mathbf{A}\mathbf{x}+\mathbf{B}\mathbf{u} \):

\[ \mathbf{T}\dot{\mathbf{z}}(t) = \mathbf{A}\mathbf{T}\mathbf{z}(t) + \mathbf{B}\mathbf{u}(t) \;\;\Rightarrow\;\; \dot{\mathbf{z}}(t) = \underbrace{\mathbf{T}^{-1}\mathbf{A}\mathbf{T}}_{\mathbf{\bar A}}\mathbf{z}(t) + \underbrace{\mathbf{T}^{-1}\mathbf{B}}_{\mathbf{\bar B}}\mathbf{u}(t) \]

For the output equation, \( \mathbf{y}(t)=\mathbf{C}\mathbf{x}(t)+\mathbf{D}\mathbf{u}(t)=\mathbf{C}\mathbf{T}\mathbf{z}(t)+\mathbf{D}\mathbf{u}(t) \), so define \( \mathbf{\bar C}=\mathbf{C}\mathbf{T} \) and \( \mathbf{\bar D}=\mathbf{D} \).

2.2 Discrete-time derivation

For a discrete-time model \( \mathbf{x}_{k+1}=\mathbf{A}\mathbf{x}_k+\mathbf{B}\mathbf{u}_k \), \( \mathbf{y}_k=\mathbf{C}\mathbf{x}_k+\mathbf{D}\mathbf{u}_k \), define \( \mathbf{x}_k=\mathbf{T}\mathbf{z}_k \):

\[ \mathbf{T}\mathbf{z}_{k+1}=\mathbf{A}\mathbf{T}\mathbf{z}_k+\mathbf{B}\mathbf{u}_k \;\;\Rightarrow\;\; \mathbf{z}_{k+1}=\mathbf{T}^{-1}\mathbf{A}\mathbf{T}\,\mathbf{z}_k + \mathbf{T}^{-1}\mathbf{B}\,\mathbf{u}_k \]

The transformation rules are identical: \( \mathbf{\bar A}=\mathbf{T}^{-1}\mathbf{A}\mathbf{T} \), \( \mathbf{\bar B}=\mathbf{T}^{-1}\mathbf{B} \), \( \mathbf{\bar C}=\mathbf{C}\mathbf{T} \), \( \mathbf{\bar D}=\mathbf{D} \).

2.3 Equivalence as a precise definition

Two realizations \( (\mathbf{A},\mathbf{B},\mathbf{C},\mathbf{D}) \) and \( (\mathbf{\bar A},\mathbf{\bar B},\mathbf{\bar C},\mathbf{\bar D}) \) are state-coordinate equivalent if there exists an invertible \( \mathbf{T} \) such that:

\[ \mathbf{\bar A}=\mathbf{T}^{-1}\mathbf{A}\mathbf{T},\quad \mathbf{\bar B}=\mathbf{T}^{-1}\mathbf{B},\quad \mathbf{\bar C}=\mathbf{C}\mathbf{T},\quad \mathbf{\bar D}=\mathbf{D}. \]

3. What Does Not Change? Invariants and Proofs

3.1 Matrix exponential similarity identity

The continuous-time state transition matrix is \( e^{\mathbf{A}t} \). Similarity transformations preserve it in a specific way.

Theorem (Similarity of matrix exponentials): For invertible \( \mathbf{T} \) and any real \( t \),

\[ e^{(\mathbf{T}^{-1}\mathbf{A}\mathbf{T})t} = \mathbf{T}^{-1}e^{\mathbf{A}t}\mathbf{T}. \]

Proof: Use the power-series definition \( e^{\mathbf{M}}=\sum_{k=0}^{\infty}\frac{1}{k!}\mathbf{M}^k \). Since \( (\mathbf{T}^{-1}\mathbf{A}\mathbf{T})^k=\mathbf{T}^{-1}\mathbf{A}^k\mathbf{T} \),

\[ e^{(\mathbf{T}^{-1}\mathbf{A}\mathbf{T})t} = \sum_{k=0}^{\infty}\frac{t^k}{k!}(\mathbf{T}^{-1}\mathbf{A}\mathbf{T})^k = \sum_{k=0}^{\infty}\frac{t^k}{k!}\mathbf{T}^{-1}\mathbf{A}^k\mathbf{T} = \mathbf{T}^{-1}\left(\sum_{k=0}^{\infty}\frac{t^k}{k!}\mathbf{A}^k\right)\mathbf{T} = \mathbf{T}^{-1}e^{\mathbf{A}t}\mathbf{T}. \]

Therefore state trajectories map consistently by \( \mathbf{x}(t)=\mathbf{T}\mathbf{z}(t) \).

3.2 Input–output equivalence and transfer function invariance

For continuous-time LTI systems (zero initial condition), the transfer function matrix is:

\[ \mathbf{G}(s)=\mathbf{C}(s\mathbf{I}-\mathbf{A})^{-1}\mathbf{B}+\mathbf{D}. \]

Theorem (Transfer function invariance): If \( (\mathbf{\bar A},\mathbf{\bar B},\mathbf{\bar C},\mathbf{\bar D}) \) is obtained by a similarity transform, then \( \mathbf{\bar G}(s)=\mathbf{G}(s) \).

Proof: Note the resolvent identity: \( s\mathbf{I}-\mathbf{\bar A}=s\mathbf{I}-\mathbf{T}^{-1}\mathbf{A}\mathbf{T}=\mathbf{T}^{-1}(s\mathbf{I}-\mathbf{A})\mathbf{T} \), hence \( (s\mathbf{I}-\mathbf{\bar A})^{-1}=\mathbf{T}^{-1}(s\mathbf{I}-\mathbf{A})^{-1}\mathbf{T} \). Then:

\[ \mathbf{\bar G}(s) = \mathbf{\bar C}(s\mathbf{I}-\mathbf{\bar A})^{-1}\mathbf{\bar B}+\mathbf{\bar D} = (\mathbf{C}\mathbf{T})\left[\mathbf{T}^{-1}(s\mathbf{I}-\mathbf{A})^{-1}\mathbf{T}\right](\mathbf{T}^{-1}\mathbf{B})+\mathbf{D} = \\ \mathbf{C}(s\mathbf{I}-\mathbf{A})^{-1}\mathbf{B}+\mathbf{D} = \mathbf{G}(s). \]

3.3 Eigenvalues (poles) are invariant

Similar matrices have the same characteristic polynomial and thus the same eigenvalues. This is fundamental because eigenvalues of \( \mathbf{A} \) govern natural modes.

Theorem (Characteristic polynomial invariance):

\[ \det(\lambda\mathbf{I}-\mathbf{\bar A})=\det(\lambda\mathbf{I}-\mathbf{A}). \]

Proof:

\[ \det(\lambda\mathbf{I}-\mathbf{\bar A}) = \det(\lambda\mathbf{I}-\mathbf{T}^{-1}\mathbf{A}\mathbf{T}) = \det\!\left(\mathbf{T}^{-1}(\lambda\mathbf{I}-\mathbf{A})\mathbf{T}\right) = \\ \det(\mathbf{T}^{-1})\det(\lambda\mathbf{I}-\mathbf{A})\det(\mathbf{T}) = \det(\lambda\mathbf{I}-\mathbf{A}). \]

Consequently, stability conclusions based on eigenvalues (introduced later formally) do not depend on the chosen state coordinates.

3.4 Controllability and observability ranks are invariant

For a continuous-time (or discrete-time) system, define the controllability matrix (SISO form) as \( \mathcal{C}=[\mathbf{B}\;\;\mathbf{A}\mathbf{B}\;\;\cdots\;\;\mathbf{A}^{n-1}\mathbf{B}] \) and the observability matrix as \( \mathcal{O}=\begin{bmatrix}\mathbf{C}\\ \mathbf{C}\mathbf{A}\\ \vdots\\ \mathbf{C}\mathbf{A}^{n-1}\end{bmatrix} \).

Theorem (Rank invariance): \( \operatorname{rank}(\mathcal{\bar C})=\operatorname{rank}(\mathcal{C}) \) and \( \operatorname{rank}(\mathcal{\bar O})=\operatorname{rank}(\mathcal{O}) \).

Proof (controllability): Since \( \mathbf{\bar A}=\mathbf{T}^{-1}\mathbf{A}\mathbf{T} \) and \( \mathbf{\bar B}=\mathbf{T}^{-1}\mathbf{B} \), we have by induction \( \mathbf{\bar A}^k\mathbf{\bar B}=\mathbf{T}^{-1}\mathbf{A}^k\mathbf{B} \). Therefore

\[ \mathcal{\bar C}= [\mathbf{\bar B}\;\;\mathbf{\bar A}\mathbf{\bar B}\;\;\cdots\;\;\mathbf{\bar A}^{n-1}\mathbf{\bar B}] = \mathbf{T}^{-1}[\mathbf{B}\;\;\mathbf{A}\mathbf{B}\;\;\cdots\;\;\mathbf{A}^{n-1}\mathbf{B}] = \mathbf{T}^{-1}\mathcal{C}. \]

Multiplication by an invertible matrix does not change rank, hence \( \operatorname{rank}(\mathcal{\bar C})=\operatorname{rank}(\mathcal{C}) \). The observability proof is analogous because \( \mathcal{\bar O}=\mathcal{O}\mathbf{T} \).

4. Constructive Equivalence: How to Recover \( \mathbf{T} \) (When Possible)

Suppose you are given two state-space models of the same order: \( (\mathbf{A},\mathbf{B},\mathbf{C},\mathbf{D}) \) and \( (\mathbf{A}_2,\mathbf{B}_2,\mathbf{C}_2,\mathbf{D}_2) \). A practical goal is to decide whether there exists an invertible \( \mathbf{T} \) such that \( \mathbf{A}_2=\mathbf{T}^{-1}\mathbf{A}\mathbf{T} \), \( \mathbf{B}_2=\mathbf{T}^{-1}\mathbf{B} \), \( \mathbf{C}_2=\mathbf{C}\mathbf{T} \), \( \mathbf{D}_2=\mathbf{D} \).

4.1 Similarity is an equivalence relation

Define the relation \( \sim \) on realizations by \( (\mathbf{A},\mathbf{B},\mathbf{C},\mathbf{D})\sim(\mathbf{A}_2,\mathbf{B}_2,\mathbf{C}_2,\mathbf{D}_2) \) if such an invertible \( \mathbf{T} \) exists. Then:

  • Reflexive: choose \( \mathbf{T}=\mathbf{I} \).
  • Symmetric: if \( \mathbf{T} \) works, then \( \mathbf{T}^{-1} \) maps back.
  • Transitive: if \( \mathbf{T}_1 \) maps 1→2 and \( \mathbf{T}_2 \) maps 2→3, then \( \mathbf{T}_1\mathbf{T}_2 \) maps 1→3.

4.2 Recovering \( \mathbf{T} \) using controllability (SISO, full rank)

For SISO systems (one input), the SISO controllability matrix is square: \( \mathcal{C}=[\mathbf{B}\;\;\mathbf{A}\mathbf{B}\;\;\cdots\;\;\mathbf{A}^{n-1}\mathbf{B}]\in\mathbb{R}^{n\times n} \). If \( \det(\mathcal{C})\neq 0 \), the realization is controllable.

If the two realizations are related by similarity, then as shown in Section 3.4: \( \mathcal{C}_2=\mathbf{T}^{-1}\mathcal{C} \). If both are controllable (so both matrices are invertible), then

\[ \mathcal{C}_2=\mathbf{T}^{-1}\mathcal{C} \;\;\Rightarrow\;\; \mathbf{T}=\mathcal{C}\mathcal{C}_2^{-1}. \]

After computing \( \mathbf{T} \), you must verify consistency: \( \mathbf{A}_2 \stackrel{?}{=} \mathbf{T}^{-1}\mathbf{A}\mathbf{T} \), \( \mathbf{B}_2 \stackrel{?}{=} \mathbf{T}^{-1}\mathbf{B} \), \( \mathbf{C}_2 \stackrel{?}{=} \mathbf{C}\mathbf{T} \), \( \mathbf{D}_2 \stackrel{?}{=} \mathbf{D} \).

4.3 Recovering \( \mathbf{T} \) using observability (SISO, full rank)

The SISO observability matrix is \( \mathcal{O}=\begin{bmatrix}\mathbf{C}\\ \mathbf{C}\mathbf{A}\\ \vdots\\ \mathbf{C}\mathbf{A}^{n-1}\end{bmatrix}\in\mathbb{R}^{n\times n} \). If \( \det(\mathcal{O})\neq 0 \), the realization is observable. Under similarity, \( \mathcal{O}_2=\mathcal{O}\mathbf{T} \), hence if both are observable:

\[ \mathcal{O}_2=\mathcal{O}\mathbf{T} \;\;\Rightarrow\;\; \mathbf{T}=\mathcal{O}^{-1}\mathcal{O}_2. \]

4.4 Minimal realizations and uniqueness up to similarity

A realization is called minimal if it has the smallest possible state dimension among all realizations that produce the same transfer function. In this chapter, a standard sufficient characterization is: \( \text{minimal} \iff \text{controllable and observable} \).

Theorem (Uniqueness of minimal realizations up to similarity): If two realizations are both minimal and have the same transfer function, then they are similar (state-coordinate equivalent).

This theorem explains why canonical forms in Lesson 3 are powerful: they represent an entire equivalence class of models sharing the same input–output behavior.

flowchart TD
  I["Given (A,B,C,D) and (A2,B2,C2,D2)"] --> D["Check D2 == D"]
  D --> R["Compute invariants: eigenvalues(A) vs eigenvalues(A2)"]
  R --> C1["If SISO and controllable: build Cmat, Cmat2"]
  R --> O1["If SISO and observable: build Omat, Omat2"]
  C1 --> T1["Candidate T = Cmat * inv(Cmat2)"]
  O1 --> T2["Candidate T = inv(Omat) * Omat2"]
  T1 --> V["Verify: A2=inv(T)AT, B2=inv(T)B, C2=CT"]
  T2 --> V
  V --> OK["Equivalent (similar)"]
  V --> NO["Not similar (or numerically ill-conditioned)"]
        

4.5 Numerical note: conditioning

In practice, matrices like \( \mathcal{C} \) or \( \mathcal{O} \) may be ill-conditioned even when invertible. This can make computed \( \mathbf{T} \) numerically unstable. Robust workflows therefore:

  • use rank-revealing factorizations (QR/SVD) to test controllability/observability,
  • verify equivalence by checking norms (e.g., \( \|\mathbf{A}_2-\mathbf{T}^{-1}\mathbf{A}\mathbf{T}\| \)),
  • compare input–output responses (impulse/step) as a sanity check.

5. Python Lab: Similarity Transform, Invariants, and Recovering \( \mathbf{T} \)

Common Python libraries for state-space work in system dynamics include \( \texttt{numpy} \), \( \texttt{scipy.linalg} \), \( \texttt{scipy.signal} \), and the Control Systems library \( \texttt{control} \) (often installed as python-control).


import numpy as np
import scipy.linalg as la

# Example SISO system (controllable and observable)
A = np.array([[0.0, 1.0],
              [-2.0, -3.0]])
B = np.array([[0.0],
              [1.0]])
C = np.array([[1.0, 0.0]])
D = np.array([[0.0]])

# Random invertible similarity transform T
rng = np.random.default_rng(4)
T = rng.normal(size=(2, 2))
while abs(np.linalg.det(T)) < 1e-2:
    T = rng.normal(size=(2, 2))

A2 = la.inv(T) @ A @ T
B2 = la.inv(T) @ B
C2 = C @ T
D2 = D.copy()

# Invariants: eigenvalues
lam_A = np.linalg.eigvals(A)
lam_A2 = np.linalg.eigvals(A2)
print("eig(A) :", lam_A)
print("eig(A2):", lam_A2)

# Build SISO controllability matrices (square here because n=2)
Cmat  = np.hstack([B, A @ B])
Cmat2 = np.hstack([B2, A2 @ B2])

# Recover candidate T from controllability
T_hat = Cmat @ la.inv(Cmat2)

# Verify similarity relations numerically
def rel_err(X, Y):
    return la.norm(X - Y) / max(1.0, la.norm(X))

print("relerr(A2, inv(T_hat) A T_hat) =", rel_err(A2, la.inv(T_hat) @ A @ T_hat))
print("relerr(B2, inv(T_hat) B)       =", rel_err(B2, la.inv(T_hat) @ B))
print("relerr(C2, C T_hat)            =", rel_err(C2, C @ T_hat))
print("relerr(D2, D)                  =", rel_err(D2, D))

# Optional: verify transfer function invariance by comparing Markov parameters:
# h[1] = C B, h[2] = C A B, ...
H1  = C @ B
H2  = C @ A @ B
H1_2 = C2 @ B2
H2_2 = C2 @ A2 @ B2
print("Markov check h1:", H1, H1_2)
print("Markov check h2:", H2, H2_2)
      

The Markov parameter check (\( \mathbf{C}\mathbf{A}^{k-1}\mathbf{B} \)) is a lightweight way to confirm that the impulse response coefficients match (for discrete-time) and similarly reflects invariance in continuous-time expansions.

6. MATLAB / Simulink Lab: Coordinate Changes and Verification

MATLAB Control System Toolbox supports state-space objects via ss. A similarity transformation can be implemented directly using matrix operations, and input–output equivalence can be checked by comparing transfer functions or time responses.


% Example SISO system
A = [0 1; -2 -3];
B = [0; 1];
C = [1 0];
D = 0;

sys  = ss(A,B,C,D);

% Choose an invertible similarity transform T
T = [2 1; 1 1];
A2 = inv(T)*A*T;
B2 = inv(T)*B;
C2 = C*T;
D2 = D;

sys2 = ss(A2,B2,C2,D2);

% Invariants
eigA  = eig(A);
eigA2 = eig(A2);

disp(eigA); disp(eigA2);

% Transfer-function equality (symbolic equality may not be exact numerically)
G1 = tf(sys);
G2 = tf(sys2);

% Compare frequency response numerically
w = logspace(-2,2,200);
mag1 = squeeze(abs(freqresp(sys, w)));
mag2 = squeeze(abs(freqresp(sys2, w)));
disp(max(abs(mag1 - mag2)));

% Compare step responses
t = linspace(0,10,2000);
y1 = step(sys, t);
y2 = step(sys2, t);
disp(max(abs(y1 - y2)));

% If available, ss2ss can perform coordinate changes directly:
% sys2b = ss2ss(sys, T);  % interprets transformation consistent with x = T*z
      

In Simulink, you can use the State-Space block with matrices \( \mathbf{A},\mathbf{B},\mathbf{C},\mathbf{D} \). If you build two blocks with \( (A,B,C,D) \) and \( (A2,B2,C2,D) \) and drive them with the same input, their outputs should coincide (up to numerical solver tolerances).


% Programmatically create a simple Simulink model with two State-Space blocks
model = 'ss_similarity_demo';
new_system(model); open_system(model);

add_block('simulink/Sources/Step', [model '/u']);
add_block('simulink/Continuous/State-Space', [model '/Sys1']);
add_block('simulink/Continuous/State-Space', [model '/Sys2']);
add_block('simulink/Sinks/Scope', [model '/Scope']);

set_param([model '/Sys1'], 'A', mat2str(A),  'B', mat2str(B),  'C', mat2str(C),  'D', mat2str(D));
set_param([model '/Sys2'], 'A', mat2str(A2), 'B', mat2str(B2), 'C', mat2str(C2), 'D', mat2str(D2));

add_line(model, 'u/1', 'Sys1/1');
add_line(model, 'u/1', 'Sys2/1');
add_line(model, 'Sys1/1', 'Scope/1');
add_line(model, 'Sys2/1', 'Scope/2');

set_param(model, 'StopTime', '10');
save_system(model);
      

7. C++ Lab (Eigen): Similarity Transform and Output Equivalence by Simulation

In C++, a common workflow is to use Eigen for linear algebra, then implement simulation (Euler / Runge–Kutta) to compare outputs. Below is a compact Euler simulation demonstrating output equivalence after a similarity transform.


#include <iostream>
#include <Eigen/Dense>

int main() {
  using Eigen::MatrixXd;
  using Eigen::VectorXd;

  // System matrices (SISO)
  MatrixXd A(2,2), B(2,1), C(1,2), D(1,1);
  A << 0.0, 1.0,
      -2.0, -3.0;
  B << 0.0,
       1.0;
  C << 1.0, 0.0;
  D << 0.0;

  // Similarity transform
  MatrixXd T(2,2);
  T << 2.0, 1.0,
       1.0, 1.0;

  MatrixXd Tinv = T.inverse();
  MatrixXd A2 = Tinv * A * T;
  MatrixXd B2 = Tinv * B;
  MatrixXd C2 = C * T;
  MatrixXd D2 = D;

  // Euler simulation parameters
  double dt = 0.001;
  int N = 5000;
  VectorXd x = VectorXd::Zero(2);
  VectorXd z = VectorXd::Zero(2);

  // Step input u(t)=1
  double max_abs_diff = 0.0;

  for (int k = 0; k < N; ++k) {
    double u = 1.0;

    // Original system
    VectorXd xdot = A * x + B * u;
    x = x + dt * xdot;
    double y = (C * x)(0) + (D * u)(0);

    // Transformed system in z-coordinates
    VectorXd zdot = A2 * z + B2 * u;
    z = z + dt * zdot;
    double y2 = (C2 * z)(0) + (D2 * u)(0);

    double diff = std::abs(y - y2);
    if (diff > max_abs_diff) max_abs_diff = diff;
  }

  std::cout << "max |y - y2| over simulation = " << max_abs_diff << std::endl;
  return 0;
}
      

8. Java Lab (EJML): Compute Transform and Verify Relations

In Java, EJML (Efficient Java Matrix Library) is a widely used linear algebra library for control-oriented computations. The example below computes the similarity-transformed matrices and checks algebraic consistency.


import org.ejml.simple.SimpleMatrix;

public class SimilarityDemo {
  static double relErr(SimpleMatrix X, SimpleMatrix Y) {
    double denom = Math.max(1.0, X.normF());
    return X.minus(Y).normF() / denom;
  }

  public static void main(String[] args) {
    SimpleMatrix A = new SimpleMatrix(new double[][]{
      {0.0, 1.0},
      {-2.0, -3.0}
    });
    SimpleMatrix B = new SimpleMatrix(new double[][]{
      {0.0},
      {1.0}
    });
    SimpleMatrix C = new SimpleMatrix(new double[][]{
      {1.0, 0.0}
    });
    SimpleMatrix D = new SimpleMatrix(new double[][]{
      {0.0}
    });

    SimpleMatrix T = new SimpleMatrix(new double[][]{
      {2.0, 1.0},
      {1.0, 1.0}
    });
    SimpleMatrix Tinv = T.invert();

    SimpleMatrix A2 = Tinv.mult(A).mult(T);
    SimpleMatrix B2 = Tinv.mult(B);
    SimpleMatrix C2 = C.mult(T);
    SimpleMatrix D2 = D.copy();

    System.out.println("relerr(A2, inv(T)AT) = " + relErr(A2, Tinv.mult(A).mult(T)));
    System.out.println("relerr(B2, inv(T)B)  = " + relErr(B2, Tinv.mult(B)));
    System.out.println("relerr(C2, CT)       = " + relErr(C2, C.mult(T)));
    System.out.println("relerr(D2, D)        = " + relErr(D2, D));
  }
}
      

9. Wolfram Mathematica Lab: Symbolic Transfer Function Invariance

Mathematica can verify invariance symbolically by computing \( \mathbf{G}(s)=\mathbf{C}(s\mathbf{I}-\mathbf{A})^{-1}\mathbf{B}+\mathbf{D} \) and comparing it before and after transformation.


(* Define system matrices *)
A = { {0, 1}, {-2, -3} };
B = { {0}, {1} };
C = { {1, 0} };
D = { {0} };

(* Similarity transform *)
T = { {2, 1}, {1, 1} };
A2 = Inverse[T].A.T;
B2 = Inverse[T].B;
C2 = C.T;
D2 = D;

(* Transfer function G(s) = C (sI - A)^(-1) B + D *)
s = Symbol["s"];
I2 = IdentityMatrix[2];

G1 = Simplify[C.Inverse[s I2 - A].B + D];
G2 = Simplify[C2.Inverse[s I2 - A2].B2 + D2];

Print["G1(s) = ", G1];
Print["G2(s) = ", G2];
Print["Simplify[G1 - G2] = ", Simplify[G1 - G2]];

(* Eigenvalue invariance *)
Print["Eigenvalues(A)  = ", Eigenvalues[A]];
Print["Eigenvalues(A2) = ", Eigenvalues[A2]];
      

10. Problems and Solutions

Problem 1 (Derive the transformed model): Consider the continuous-time system \( \dot{\mathbf{x}}=\mathbf{A}\mathbf{x}+\mathbf{B}\mathbf{u} \), \( \mathbf{y}=\mathbf{C}\mathbf{x}+\mathbf{D}\mathbf{u} \). Let \( \mathbf{x}=\mathbf{T}\mathbf{z} \) for an invertible \( \mathbf{T} \). Derive formulas for \( \mathbf{\bar A},\mathbf{\bar B},\mathbf{\bar C},\mathbf{\bar D} \).

Solution: Substitute \( \mathbf{x}=\mathbf{T}\mathbf{z} \) and \( \dot{\mathbf{x}}=\mathbf{T}\dot{\mathbf{z}} \):

\[ \mathbf{T}\dot{\mathbf{z}}=\mathbf{A}\mathbf{T}\mathbf{z}+\mathbf{B}\mathbf{u} \;\;\Rightarrow\;\; \dot{\mathbf{z}}=\mathbf{T}^{-1}\mathbf{A}\mathbf{T}\mathbf{z}+\mathbf{T}^{-1}\mathbf{B}\mathbf{u}. \]

Output: \( \mathbf{y}=\mathbf{C}\mathbf{T}\mathbf{z}+\mathbf{D}\mathbf{u} \). Therefore \( \mathbf{\bar A}=\mathbf{T}^{-1}\mathbf{A}\mathbf{T} \), \( \mathbf{\bar B}=\mathbf{T}^{-1}\mathbf{B} \), \( \mathbf{\bar C}=\mathbf{C}\mathbf{T} \), \( \mathbf{\bar D}=\mathbf{D} \).

Problem 2 (Prove transfer function invariance): Prove that \( \mathbf{G}(s)=\mathbf{C}(s\mathbf{I}-\mathbf{A})^{-1}\mathbf{B}+\mathbf{D} \) is unchanged by similarity transformations.

Solution: Using \( s\mathbf{I}-\mathbf{\bar A}=\mathbf{T}^{-1}(s\mathbf{I}-\mathbf{A})\mathbf{T} \),

\[ (s\mathbf{I}-\mathbf{\bar A})^{-1}=\mathbf{T}^{-1}(s\mathbf{I}-\mathbf{A})^{-1}\mathbf{T}. \]

Then substitute \( \mathbf{\bar B}=\mathbf{T}^{-1}\mathbf{B} \), \( \mathbf{\bar C}=\mathbf{C}\mathbf{T} \), \( \mathbf{\bar D}=\mathbf{D} \):

\[ \mathbf{\bar G}(s)=(\mathbf{C}\mathbf{T})\left[\mathbf{T}^{-1}(s\mathbf{I}-\mathbf{A})^{-1}\mathbf{T}\right](\mathbf{T}^{-1}\mathbf{B})+\mathbf{D} =\mathbf{C}(s\mathbf{I}-\mathbf{A})^{-1}\mathbf{B}+\mathbf{D}=\mathbf{G}(s). \]

Problem 3 (Recover \( \mathbf{T} \) from controllability, SISO): Let two SISO realizations of order \( n \) be related by similarity, and assume both are controllable. Show that \( \mathbf{T}=\mathcal{C}\mathcal{C}_2^{-1} \), where \( \mathcal{C}=[\mathbf{B}\;\mathbf{A}\mathbf{B}\;\cdots\;\mathbf{A}^{n-1}\mathbf{B}] \) and \( \mathcal{C}_2=[\mathbf{B}_2\;\mathbf{A}_2\mathbf{B}_2\;\cdots\;\mathbf{A}_2^{n-1}\mathbf{B}_2] \).

Solution: From Section 3.4, for SISO similarity transforms,

\[ \mathcal{C}_2 = \mathbf{T}^{-1}\mathcal{C}. \]

If both systems are controllable, then \( \det(\mathcal{C})\neq 0 \) and \( \det(\mathcal{C}_2)\neq 0 \). Multiply both sides by \( \mathcal{C}_2^{-1} \) on the right:

\[ \mathcal{C}_2\mathcal{C}_2^{-1}=\mathbf{T}^{-1}\mathcal{C}\mathcal{C}_2^{-1} \;\;\Rightarrow\;\; \mathbf{I}=\mathbf{T}^{-1}\mathcal{C}\mathcal{C}_2^{-1} \;\;\Rightarrow\;\; \mathbf{T}=\mathcal{C}\mathcal{C}_2^{-1}. \]

Problem 4 (Rank invariance test): Show that if \( \operatorname{rank}(\mathcal{C}) < n \) for one realization, then it must also satisfy \( \operatorname{rank}(\mathcal{C}_2) < n \) for any similar realization.

Solution: Similarity implies \( \mathcal{C}_2=\mathbf{T}^{-1}\mathcal{C} \). Since \( \mathbf{T}^{-1} \) is invertible, left multiplication cannot change rank: \( \operatorname{rank}(\mathcal{C}_2)=\operatorname{rank}(\mathcal{C}) \). Therefore if one is rank-deficient, so is the other.

Problem 5 (Eigenvalue-based necessary condition): Two realizations are claimed to be similar. Provide a necessary condition using eigenvalues and justify it.

Solution: A necessary condition is that \( \mathbf{A} \) and \( \mathbf{A}_2 \) have the same characteristic polynomial (hence identical eigenvalues with multiplicity). This follows from \( \mathbf{A}_2=\mathbf{T}^{-1}\mathbf{A}\mathbf{T} \) and the determinant identity:

\[ \det(\lambda\mathbf{I}-\mathbf{A}_2)=\det(\lambda\mathbf{I}-\mathbf{A}). \]

If eigenvalues differ, the realizations cannot be related by a similarity transformation (and therefore cannot be state-coordinate equivalent).

11. Summary

We defined similarity (state-coordinate) transformations and proved that they preserve the input–output map, transfer function, eigenvalues, and controllability/observability ranks. We also provided constructive SISO formulas to recover the transformation matrix \( \mathbf{T} \) from controllability or observability matrices and implemented equivalence verification workflows across Python, MATLAB/Simulink, C++, Java, and Mathematica. These results justify why canonical forms (Lesson 3) represent entire equivalence classes of realizations, and they set up the next lesson connecting state-space models to transfer functions.

12. References

  1. Kalman, R.E. (1960). Contributions to the theory of optimal control. Bol. Soc. Mat. Mexicana, 5, 102–119.
  2. Kalman, R.E. (1963). Mathematical description of linear dynamical systems. Journal of the Society for Industrial and Applied Mathematics, Series A: Control, 1(2), 152–192.
  3. Ho, B.L., & Kalman, R.E. (1966). Effective construction of linear state-variable models from input/output functions. Regelungstechnik, 14, 545–548.
  4. Rosenbrock, H.H. (1970). State-space and multivariable theory. Proceedings of the IEE, 117(11), 2137–2148.
  5. Wonham, W.M. (1967). On pole assignment in multi-input controllable linear systems. IEEE Transactions on Automatic Control, 12(6), 660–665.
  6. Kailath, T. (1972). The structure of linear systems. IEEE Transactions on Automatic Control, 17(4), 477–486.
  7. Silverman, L.M. (1969). Realization of linear dynamical systems. IEEE Transactions on Automatic Control, 14(6), 554–567.
  8. Glover, K. (1984). All optimal Hankel-norm approximations of linear multivariable systems and their \(L^\infty\)-error bounds. International Journal of Control, 39(6), 1115–1193.