A coordinate system assigns an origin and axes to represent positions numerically. In two dimensions, an array such as (x, y) identifies a point relative to those chosen axes; the underlying vector remains independent of that choice. section 2.1.1
For machine learning, this choice turns inputs and outputs into points in a space where models can be viewed as geometric transformations. Rotating the axes changes the representation without changing the underlying geometric object. section 2.1.1 section 2.17
A coordinate system supports several related operations:
- Represent points with coordinate arrays in two or more dimensions. section 2.1.1
- Rotate axes so a quadratic form becomes diagonal and aligned with an ellipse’s axes. section 2.17
- Interpret eigenvectors of a symmetric matrix as the axes of the represented hyperellipse. section 2.17
Page coordinates and a rotated ellipse
Using the bottom-left corner of a page as the origin and its edges as axes gives the top-right corner coordinates based on the page width and height. For 5x² + 6xy + 5y² = 20, rotating the coordinate system by 45° aligns the axes with the ellipse. section 2.1.1 section 2.17.1
Listing 2.21 Axes of a hyperellipse
ellipse_eq = sy.Eq(5*x**2 + 5*y**2 +
6*x*y, 20) ①
A = torch.tensor([[5, 3], [3, 5]]).float()
l, S = torch.linalg.eig(A)
x_axis_vec = torch.zeros((A.shape[0])) ②
first_eigen_vec = S[:, 0] ③
dot_prod = torch.dot(x_axis_vec, first_eigen_vec) ④
theta = math.acos(dot_prod)
theta = math.degrees(theta) ⑤ ① Equation of the ellipse: 5x2 + 6xy + 5y2 = 20 or ② X-axis vector ③ Major axis of the ellipse ④ The dot product between two vectors is the cosine of the angle between them. ⑤ The angle between the ellipse’s major axis and the X-axis: 45° (see figure 2.16) |
Inspect the PyTorch listing that computes an ellipse’s principal direction and its angle from the x-axis. section 2.17.1



