# Representing the Heart Shape Precisely

Valentine’s Day is over now1; it was the day where school kids were expected to give cards to each other and everyone stuffed themselves with chocolate. Oh, and it had something to do with love, too, and with that, you find the famous heart symbol everywhere.

If you were asked to show the heart shape, you’d probably just draw it. Doing it that way is really imprecise; how is your valentine supposed to take you seriously when they see how you don’t care about the little details?
We mathematicians can do better: we can give you an equation.

I’ll try to help you out: I’ve listed some of the ways you can represent the heart shape with math or computers, in order of increasing sophistication, so you can show your valentine that you care.

### Emoticon

I’m sure you’re quite familiar with this one. It’s the best approximation of the heart shape using a minimal number of ASCII characters. Unlike most emoticons, this one is rotated π/2—er, 90°— clockwise from its upright position.

<3

### Georgian Letter

Really? Some people use this character, ghan, to approximate the heart shape. I’m sure they don’t even know how to write the letter properly (you start at the bottom-left and complete the character without lifting the pen). Ghan is the 26th letter of the Georgian alphabet; it makes the sound /ɣ/, the voiced velar fricative, which isn’t even found in English, although it could be approximated with “gh”. This character is found at Unicode point U+10E6.

At least it’s upright and is only one character.

### Unicode Glyphs

You may have discovered that pressing Alt+3 on Windows will produce a heart symbol. This is originated in the old IBM: you would input special characters using an Alt code. Today, the heart symbol has been incorporated into the Unicode pages in multiple points. Here are some of them:

U+2665 BLACK HEART SUITU+2661 WHITE HEART SUIT
💔 U+1F494 BROKEN HEART
💕 U+1F495 TWO HEARTS

Of course, since these are characters, you can colour them like you can with regular text:

### Polar Plot

Now we get into the mathematical representations. In the Cartesian coordinate system, points are represented as (x,y), where the x- and y-axes are perpendicular to each other. In the polar coordinate system, points are represented as (r, θ), where r is the distance away from the origin (the “radius”), and θ is the angle counterclockwise from what would be the positive part of the x-axis on a Cartesian plot.

#### $r=1-\cos\theta$

sage: polar_plot(1-cos(x),(x,0,2*pi),color=”#FF0000″,thickness=2)

#### $r=1-\sin\theta$

sage: polar_plot(1-sin(x),(x,0,2*pi),color=”#FF0000″,thickness=2)

This curve, known as the cardioid, can be made by tracing a point on the circumerence of a circle rolling around another circle of equal size…

… or by taking the envelope of all the circles which pass through a given point on the circumference of a circle and whose centres lie on the circumference of the same circle.

### Two-dimensional Implicit Curve

An implicit equation is an equation in which one variable is not given as a function of another variable, often because it would be very difficult to express one variable explicitly or because the implicit relation is simpler; instead, both variables are used to define the function. The cardioid above can be implicitly defined in Cartesian space as $(x^2+y^2+x)^2=x^2+y^2$.

#### $(x^2+y^2-1)^3-x^2y^3=0$

sage: implicit_plot((x^2+y^2-1)^3-x^2*y^3==0,(x,-1.5,1.5),(y,-1.5,1.5),color=”#FF0000″,linewidth=2,plot_points=1000,gridlines=true)

### Parametric Curve

A parametric equation defines a curve by giving each component, x and y (and sometimes z), as functions of t. Curves that are very difficult or even impossible to express as explicit or implicit equations are often very simply expressed as a parametric equation. The cardioid above can be expressed as the parametric equation $[x=(\cos t)(1-\cos t, y=(\sin t)(1-\cos t))]$.

#### $(x=16\sin^3t, y=13\cos t-5\cos(2t)-2\cos(3t)-cos(4t))$

sage: parametric_plot([16*sin(t)^3,13*cos(t)-5*cos(2*t)-2*cos(3*t)-cos(4*t)],(t,0,2*pi),color=”#FF0000″,thickness=2,gridlines=true)

### Three-dimensional Implicit Surface

The last one for today. This one is perhaps the most impressive. If an implicit equation has three variables, the equation represents a three-dimensional surface.

#### $(x^2+\frac{9}{4}y^2+z^2-1)^3-x^2z^3-\frac{9}{200}y^2z^3=0$

Perhaps you can use one of these for your cards next year, and if you’re looking for a valentine, then maybe the one who recognizes the bare equation (without the plot) is the one for you.

Happy belated Valentine’s Day!

1. ^ I had meant for this post to be up for Valentine’s Day, but I wasn’t able to finish it in time.
1. Gede Prama said:

I really like and very inspired… :)

2. aa said:

lol! speaking of valentines, how would you breakdown the mathematical proof the amount of chocolate consumed is directly proportional to the amount of pounds gained? hehe

• Hmm, well, first you’d have to gather your data, and lots of it. Once you gather a sufficient number of samples, you perform regression, holding other factors constant. If the resulting equation is linear and there is no vertical shift (i.e. the line passes through the origin), then you can conclude that the relationship is directly proportional.

3. aa said:

you know i was joking right?

• Yes, I know, but if I can answer it anyway, then why not?

4. Hi, this is a very interesting article.
However the formula of the 3D heart doesn’t work.

• Huh, I thought I tried it out when i made this post, but for some reason, Sage isn’t displaying anything (maybe it’s just my browser). What are you using? WolframAlpha doesn’t seem to like it, even though it’s a valid implicit equation and it used to work before I made this post.

I got this from Wikipedia and there was a WolframAlpha ad with a similar formula, so I do assert that it works.

• Hi, thanks again for your article.
I’m using Raydiant to render it.
It gives a shape different from a heart.
May be your formula is lacking the term -x²z³?

• Ah, yes, that’s it. I can’t believe I missed that. I’ve fixed the post. Thanks!

5. Thank you for putting this blog post together.