# Nakafa Framework: LLM
URL: https://nakafa.com/en/subject/university/bachelor/ai-ds/linear-methods/real-axis-transformation
Source: https://raw.githubusercontent.com/nakafaai/nakafa.com/refs/heads/main/packages/contents/subject/university/bachelor/ai-ds/linear-methods/real-axis-transformation/en.mdx
Output docs content for large language models.
---
export const metadata = {
  title: "Real Axis Transformation",
  description: "Learn quadratic forms with symmetric matrices, eigenvalue-based coordinate transformation, and conic section classification including ellipses, hyperbolas, and parabolas.",
  authors: [{ name: "Nabil Akbarazzima Fatih" }],
  date: "07/16/2025",
  subject: "Linear Methods of AI",
};
import { LineEquation } from "@repo/design-system/components/contents/line-equation";
import { getColor } from "@repo/design-system/lib/color";
## Quadratic Forms with Symmetric Matrices
When you encounter a general quadratic equation, the best way to understand it is by looking at its structure in matrix form. Imagine you have a symmetric matrix  with elements:
This matrix has eigenvalues  and corresponding orthonormal eigenvectors . Something interesting happens when we use coordinate transformation through the matrix .
For coordinate transformation, we use . In the new coordinates , the equation becomes:
## Completing the Square Process
For both variables with , the completing the square process is performed separately:
The result of this process gives a simpler form:
By determining the center point  and the constant , we obtain:
For , various curve forms can emerge depending on the signs of the eigenvalues.
## Curve Classification
### Both Eigenvalues Positive
If  and , then the conic section formed is an **ellipse**:
With semi-axis lengths  in the direction of  and  in the direction of .
Ellipse Visualization in Coordinates >}
  description="Ellipse curve with both positive eigenvalues and principal axes aligned with eigenvector directions."
  data={[
    {
      points: Array.from({ length: 100 }, (_, i) => {
        const t = (i / 99) * 2 * Math.PI;
        const lambda1 = 2; // λ₁ > 0
        const lambda2 = 1; // λ₂ > 0
        const gamma = 16; // γ > 0
        const m1 = 0; // δ/(2λ₁) = 0
        const m2 = 0; // ε/(2λ₂) = 0
        const r1 = Math.sqrt(gamma / lambda1);
        const r2 = Math.sqrt(gamma / lambda2);
        const x = Math.cos(t) * r1 + m1;
        const y = Math.sin(t) * r2 + m2;
        return { x, y, z: 0 };
      }),
      color: getColor("CYAN"),
      smooth: true,
      showPoints: false
    },
    {
      points: [
        { x: -4, y: 0, z: 0 },
        { x: 4, y: 0, z: 0 }
      ],
      color: getColor("EMERALD"),
      smooth: false,
      showPoints: false,
      labels: [
        {
          text: "ξ₁",
          at: 1,
          offset: [0.3, -0.3, 0]
        }
      ]
    },
    {
      points: [
        { x: 0, y: -3, z: 0 },
        { x: 0, y: 3, z: 0 }
      ],
      color: getColor("EMERALD"),
      smooth: false,
      showPoints: false,
      labels: [
        {
          text: "ξ₂",
          at: 1,
          offset: [0.3, 0.3, 0]
        }
      ]
    },
    {
      points: [
        { x: 0, y: 0, z: 0 }
      ],
      color: getColor("ROSE"),
      smooth: false,
      showPoints: true,
      labels: [
        {
          text: "Center (m₁, m₂)",
          at: 0,
          offset: [0.4, 0.4, 0]
        }
      ]
    }
  ]}
  cameraPosition={[0, 0, 12]}
  showZAxis={false}
/>
### Eigenvalues with Opposite Signs
When  and , the conic section formed is a **hyperbola**:
With semi-axis lengths  in the direction of  and  in the direction of .
Hyperbola Visualization in Coordinates >}
  description="Hyperbola curve with principal axes aligned with eigenvector directions and center transformation."
  data={[
    {
      points: Array.from({ length: 60 }, (_, i) => {
        const t = (i / 29 - 1) * 2.5;
        const lambda1 = 2; // λ₁ > 0
        const lambda2 = -1; // λ₂ < 0
        const gamma = 3; // γ > 0
        const r1 = Math.sqrt(gamma / lambda1);
        const r2 = Math.sqrt(gamma / (-lambda2));
        const x = Math.cosh(t) * r1;
        const y = Math.sinh(t) * r2;
        return { x, y, z: 0 };
      }),
      color: getColor("ORANGE"),
      smooth: true,
      showPoints: false
    },
    {
      points: Array.from({ length: 60 }, (_, i) => {
        const t = (i / 29 - 1) * 2.5;
        const lambda1 = 2;
        const lambda2 = -1;
        const gamma = 3;
        const r1 = Math.sqrt(gamma / lambda1);
        const r2 = Math.sqrt(gamma / (-lambda2));
        const x = -Math.cosh(t) * r1;
        const y = Math.sinh(t) * r2;
        return { x, y, z: 0 };
      }),
      color: getColor("ORANGE"),
      smooth: true,
      showPoints: false
    },
    {
      points: Array.from({ length: 2 }, (_, i) => {
        const lambda1 = 2;
        const lambda2 = -1;
        const gamma = 3;
        const r1 = Math.sqrt(gamma / lambda1);
        const r2 = Math.sqrt(gamma / (-lambda2));
        const slope = r2 / r1; // slope asimptot
        const x = (i - 0.5) * 6; // dari -3 ke 3
        const y = slope * x;
        return { x, y, z: 0 };
      }),
      color: getColor("SKY"),
      smooth: false,
      showPoints: false,
      labels: [
        {
          text: "r₁",
          at: 1,
          offset: [0.5, -0.5, 0]
        }
      ]
    },
    {
      points: Array.from({ length: 2 }, (_, i) => {
        const lambda1 = 2;
        const lambda2 = -1;
        const gamma = 3;
        const r1 = Math.sqrt(gamma / lambda1);
        const r2 = Math.sqrt(gamma / (-lambda2));
        const slope = -r2 / r1; // slope asimptot negatif
        const x = (i - 0.5) * 6; // dari -3 ke 3
        const y = slope * x;
        return { x, y, z: 0 };
      }),
      color: getColor("SKY"),
      smooth: false,
      showPoints: false,
      labels: [
        {
          text: "r₂",
          at: 0,
          offset: [-0.5, -0.5, 0]
        }
      ]
    },
    {
      points: [
        { x: -4, y: 0, z: 0 },
        { x: 4, y: 0, z: 0 }
      ],
      color: getColor("VIOLET"),
      smooth: false,
      showPoints: false,
      labels: [
        {
          text: "ξ₁",
          at: 1,
          offset: [0.3, -0.3, 0]
        }
      ]
    },
    {
      points: [
        { x: 0, y: -3, z: 0 },
        { x: 0, y: 3, z: 0 }
      ],
      color: getColor("VIOLET"),
      smooth: false,
      showPoints: false,
      labels: [
        {
          text: "ξ₂",
          at: 1,
          offset: [0.3, 0.3, 0]
        }
      ]
    }
  ]}
  cameraPosition={[0, 0, 12]}
  showZAxis={false}
/>
### One Eigenvalue Zero
A special condition occurs when  and . Completing the square gives:
The conic section formed is a **parabola**:
Parabola Visualization in Coordinates >}
  description="Parabola curve with one zero eigenvalue and coordinate axis transformation aligned with eigenvectors."
  data={[
    {
      points: Array.from({ length: 50 }, (_, i) => {
        const t = (i / 49 - 0.5) * 6;
        const lambda1 = 1; // λ₁ ≠ 0
        const epsilon = -2; // ε ≠ 0
        const gamma = 2; // γ
        const m1 = 0; // δ/(2λ₁) = 0
        const x = t;
        const y = -(lambda1 / epsilon) * Math.pow(x - m1, 2) + (gamma / epsilon);
        return { x, y, z: 0 };
      }),
      color: getColor("PURPLE"),
      smooth: true,
      showPoints: false
    },
    {
      points: [
        { x: -3.5, y: 0, z: 0 },
        { x: 3.5, y: 0, z: 0 }
      ],
      color: getColor("CYAN"),
      smooth: false,
      showPoints: false,
      labels: [
        {
          text: "ξ₁",
          at: 1,
          offset: [0.3, -0.3, 0]
        }
      ]
    },
    {
      points: [
        { x: 0, y: -0.5, z: 0 },
        { x: 0, y: 4, z: 0 }
      ],
      color: getColor("CYAN"),
      smooth: false,
      showPoints: false,
      labels: [
        {
          text: "ξ₂",
          at: 1,
          offset: [0.3, 0.3, 0]
        }
      ]
    }
  ]}
  cameraPosition={[0, 0, 12]}
  showZAxis={false}
/>
## Two-Dimensional Example
Conic sections in  satisfy the general quadratic equation:
Which can be written in matrix form as:
## Quadratic Surfaces and Transformation
For a symmetric matrix , vector , and scalar , the **quadratic surface**  is defined as the solution set of the general quadratic equation:
Which can be written in explicit form:
If  is symmetric and  is an orthonormal basis of eigenvectors with , then the orthonormal matrix  enables diagonalization  or .
In the new coordinate basis  and , the quadratic surface has diagonal form:
In the orthonormal basis of eigenvectors, the quadratic form has a diagonal structure. This transformation is called **principal axis transformation** because the new coordinate axes are aligned with the directions of the matrix eigenvectors.