Loading editor...

Gradient of an angle

Loading commands, almost done…

Here we use autograd to connect two theorems - one from geometry and one from calculus:

  • Inscribed angle theorem: In a circle, the angle subtended by an arc at the center is twice the angle subtended at any point on the circumference
  • Orthogonality property of the gradient: The gradient of a function points in the direction of steepest ascent, and is orthogonal to level curves

We use them to show that the gradient of an angle of a triangle always points towards its circumcenter.

Let's demonstrate this by creating a triangle and computing the gradient of one of its angles:

Setting up the triangle:

  • : t = \triangle a b c
  • : \highlight a - this is the vertex whose angle we'll optimize
  • : \param a - this tells the system that point a is trainable

Computing and backpropagating the loss:

  • : loss = \angle b a c - this calculates the angle ∠bac

When you backpropagate, you'll see the gradient vector appear at point a.

  • : \backprop loss - computes the gradient of the loss with respect to point a

This gradient points in the direction that would increase the angle ∠bac the fastest. According to the orthogonality property, this gradient is perpendicular to the level curves of the angle function - meaning if you move point a along a curve where the angle stays constant, the gradient will be perpendicular to that curve.

Since the level curve of the angle is the circumcircle of the triangle, it means that the gradient is parallel to the line joining the circumcenter to the point a.

  • : p = \circumcenter t
  • : r = \distance p a
  • : \line p a

Run the \gradient-of-an-angle command in the geomatic editor to see this in action. You can also manually run each step to understand the process better.