Rank-2 Tensor · Interactive Module

The Quadratic Form

How the tensor ax² + 2cxy + by² draws the ellipse in your demo

Theory Page
← Back to Demo

What Is a Quadratic Form?

A quadratic form is what you get when you sandwich a tensor between a vector and itself. For any vector P = (x, y) and your tensor T:

// Your tensor definition:
T = | a   c |    T11 = a,  T12 = c
    | c   b |    T21 = c,  T22 = b

// The quadratic form Q:
Q(x,y) = PT . T . P

Q(x,y) = [x  y] . | a  c | . | x |
                  | c  b |   | y |

Q(x,y) = ax² + 2cxy + by²

This single expression ax² + 2cxy + by² is the quadratic form of our tensor. Every slider in our demo directly controls one term of this equation.

The Ellipse Equation

Setting Q(x,y) = 1 gives the curve: ax² + 2cxy + by² = 1 this is exactly the ellipse drawn in your demo. The particle moves along this curve. The unit circle is the special case a = b = 1, c = 0.

What Each Term Means

Term Comes From What It Controls When c = 0
ax² T11 = a Resistance purely along x-axis Ellipse semi-axis = 1/sqrt(a)
by² T22 = b Resistance purely along y-axis Ellipse semi-axis = 1/sqrt(b)
2cxy T12 = T21 = c Coupling between x and y directions Term vanishes axes align with frame
Car Analogy - The Three Terms

Pushing in Mixed Directions

The term ax² measures the energy cost of pushing the car purely forward. The term by² measures the cost of pushing purely sideways. These are the easy-to-understand diagonal terms.

But what about pushing at 45 degrees partly forward, partly sideways? The cross term 2cxy captures this interaction. When c is nonzero, pushing in one direction also creates a resistance component in the other direction the car's response is no longer parallel to your push.

In your demo, slider c directly controls this coupling. At c = 0, the car responds exactly along your push direction. As c increases, the response tilts the ellipse rotates away from the coordinate axes.

How Sliders a, b, c Control the Shape

Slider a

Controls x-axis scale

+ a large — ellipse squashed along x-axis (tight, narrow in x direction) — semi-axis = 1/sqrt(a) gets smaller
- a small — ellipse stretched along x-axis (wide in x direction) — semi-axis = 1/sqrt(a) gets larger
Slider b

Controls y-axis scale

+ b large — ellipse squashed along y-axis — semi-axis = 1/sqrt(b) gets smaller
- b small — ellipse stretched along y-axis — semi-axis = 1/sqrt(b) gets larger
Slider c

Controls tilt and coupling

= c = 0 —> no coupling, ellipse axes align exactly with x and y axes —> this is the principal frame
+ c nonzero —> cross term 2cxy appears, ellipse tilts, principal axes rotate away from coordinate frame
! c² greater than ab —> determinant becomes negative —> the curve is no longer an ellipse but a hyperbola. The tensor is no longer positive definite
Important Constraint

For a valid ellipse to exist you need ab - c² greater than 0 (positive determinant) AND both a and b positive. This is called a positive definite tensor. If the determinant goes negative in your demo, the ellipse will disappear or break —> that is physically meaningful, not a bug.

Connection to Principal Axes and Eigenvalues

The principal axes —> the eigenvectors shown as unit vectors in our demo —> are the special directions where the cross term 2cxy disappears completely. In those rotated coordinates x', y' the quadratic form becomes purely:

// In the principal frame (eigenvector directions):
Q(x',y') = lambda_1 * x'² + lambda_2 * y'²

// Setting Q = 1 gives the ellipse semi-axes:
Semi-axis along e_1 = 1 / sqrt(lambda_1)
Semi-axis along e_2 = 1 / sqrt(lambda_2)

// Eigenvalues from your sliders a, b, c:
lambda = [ (a+b) +/- sqrt( (a-b)² + 4c² ) ] / 2

// Verification using invariants:
lambda_1 + lambda_2 = a + b  -Trace, always constant
lambda_1 * lambda_2 = ab - c²  -Determinant, always constant
Why the Unit Circle Appears in the Demo

The unit circle is the quadratic form with a = 1, b = 1, c = 0 —> giving x² + y² = 1. Our tensor T maps this unit circle to the ellipse ax² + 2cxy + by² = 1. Every point on the unit circle is transformed by T to a point on the ellipse. The moving particle traces both curves simultaneously, showing this mapping live.

Full Numerical Example

Set sliders to a = 3, b = 1, c = 1 and follow through the complete calculation:

// Tensor matrix:
T = | 3   1 |
    | 1   1 |

// Quadratic form:
Q(x,y) = 3x² + 2(1)xy + 1y²
Q(x,y) = 3x² + 2xy + y²

// Ellipse equation (Q = 1):
3x² + 2xy + y² = 1

// Invariants:
Trace = 3 + 1 = 4
Det = 3*1 - 1² = 2

// Eigenvalues:
lambda = [ 4 +/- sqrt( (3-1)² + 4*1² ) ] / 2
lambda = [ 4 +/- sqrt( 4 + 4 ) ] / 2
lambda = [ 4 +/- sqrt(8) ] / 2
lambda = [ 4 +/- 2.828 ] / 2

lambda_1 = 3.414  -- hard axis
lambda_2 = 0.586  -- easy axis

// Semi-axes of the ellipse:
r_1 = 1/sqrt(3.414) = 0.541  -> short axis
r_2 = 1/sqrt(0.586) = 1.306  ->long axis

// Check invariants hold:
lambda_1 + lambda_2 = 3.414 + 0.586 = 4.000  = Trace, confirmed
lambda_1 * lambda_2 = 3.414 * 0.586 = 2.001  = Det, confirmed
Now Try in Demo

Set a = 3, b = 1, c = 1 in demo. The ellipse semi-axes should measure approximately 0.541 and 1.306. The principal axis unit vectors will be tilted —> no longer aligned with x and y —> because c is nonzero. Drag t=theta and watch all components change while the ellipse shape stays fixed.

Everything in Five Lines

// Your tensor:
T = | a   c |
    | c   b |

// Quadratic form:
Q(x,y) = ax² + 2cxy + by²

// Ellipse in the demo:
ax² + 2cxy + by² = 1

// Eigenvalues (semi-axes = 1/sqrt of these):
lambda = [ (a+b) +/- sqrt( (a-b)² + 4c² ) ] / 2

// Invariants (never change under rotation):
Trace = a + b     Det = ab - c²
The Big Picture

The Quadratic Form is the Tensor Made Visible

The tensor T is an abstract mathematical object —> a 2x2 matrix of numbers. The quadratic form ax² + 2cxy + by² is how that abstract object becomes a concrete geometric shape you can see and interact with.

Every time you drag a slider in demo, you are reshaping the quadratic form —> stretching it, tilting it, coupling its axes. The ellipse responds instantly because it is the quadratic form, drawn on the coordinate plane. The physics, the mathematics, and the geometry are all the same object seen from three different angles.

← Back to Demo ← Trace and Determinant Invariance Next: Eigenvalues →