Implicit Heart
Watch the heart curve (x² + y² − 1)³ = x²y³ beat as a slider scales it, with two rounded lobes on top and a cusp at the bottom. Edit the equation.
One equation of degree six, (x^2 + y^2 - 1)^3 = x^2 y^3 , draws a heart, and nobody has to solve it for y . It is an implicit curve: the set of points where an equation f(x, y) = 0 holds, with no formula y = \dots to follow. This way of writing a curve keeps shapes that an explicit formula would have to cut into several branches or pieces: curves that cross themselves, loops, cusps (sharp points) and isolated points. Implicit curves are the base of level-set methods, of computational geometry, and of many algorithms that fit curves to data or recognize shapes.
The plotted equation is (x^2 + y^2 - 1)^3 - x^2 y^3 = 0 , a sixth-degree polynomial whose zero set traces the heart. The plot keeps equal units on both axes, on a domain about as tall as it is wide, and the curve comes out whole with no y = \pm\sqrt{\dots} branches to join. The two rounded lobes at the top and the two cusps, one at the bottom point (0, -1) and one at the dip between the lobes, (0, 1) , come directly from the algebra; nothing is stitched together.
To see why the equation draws a heart, take the real cube root of both sides of (x^2 + y^2 - 1)^3 = x^2 y^3 : the equation becomes x^2 + y^2 - 1 = |x|^{2/3}\, y . Without the right side, this is the unit circle. Where y > 0 the right side is positive, so the curve lies outside the circle, pushed up into two lobes; at x = 0 the push is zero, which leaves the dip at (0, 1) . Where y < 0 the curve lies inside the circle and is pulled in toward the point at (0, -1) . Solved for y , the equation has two branches, y = \frac{1}{2}\left(|x|^{2/3} \pm \sqrt{|x|^{4/3} - 4x^2 + 4}\right) , which meet at x \approx \pm 1.14 .
To plot an implicit curve, a program evaluates f on a grid. Where f has opposite signs at the two ends of a cell edge, the curve crosses that edge; the marching squares algorithm estimates each crossing by interpolation and joins the crossings in each cell with segments. An adaptive version refines only the cells near the curve, which keeps the cusps sharp.
Other heart curves exist. MathWorld's heart curve page lists this one with others, including the parametric curve x = 16\sin^3 t , y = 13\cos t - 5\cos 2t - 2\cos 3t - \cos 4t and the polar curve r = 1 - \sin\theta , a cardioid with its cusp at the top.
The document writes the equation with x/s and y/s in place of x and y . A point (x, y) is on this curve when (x/s, y/s) is on the heart, so the curve is the heart scaled by s about the origin. The slider moves s between 0.85 and 1.1 ; play it, and the heart beats.
Edit the implicit heart equation and the curve redraws. Change y^3 to y^2 , and notice that the heart is lost: the right side no longer changes sign with y , so the curve becomes symmetric about the x -axis. Change the outer exponent from 3 to 2 , and notice that the left side can no longer be negative: apart from the single point (0, -1) , the curve can exist only where y \ge 0 .
JavaScript is required to view the interactive plot.