# How to Draw Butterflies on a Graphing Calculator

Graphing calculators are not just for plotting functions and solving equations; they can also be used to generate intricate pictures using mathematical equations. In rectangular coordinates you can easily draw faces and other scenes by graphing a collection of semi-circular arcs and line segments. The trick is to figure out the right equation for each curve and line. But with polar coordinates you can trace the outline of a shape with a single polar function.

When calculus students learn polar coordinates, the first curves they learn how to graph are symmetric n-petaled flowers with polar equations of the form r(θ) = A + B*sin(nθ) + C*cos(nθ), where A, B, C, and n are parameters that determine the general shape and orientation of the flower.

Using this basic equation as a foundation, you can develop more complicated polar equations that produce more elaborate and intricate closed curves resembling butterflies. If you work with scalable vector graphics (SVG) programs, you can quickly create a variety of butterfly curves with polar coordinate equations. The example graphs in this tutorial were generated with Desmos Online Graphing Calculator.

## Basic Butterfly Curve Equation

In polar coordinates, you can draw symmetric, top-oriented butterfly-shaped closed curves using polar equations of the form

**r(θ) = constant + sum{ coeff*sin(odd*θ) } + sum{ coeff*cos(even*θ) }**

In other words, a constant term plus sine functions with odd frequency parameters plus cosine terms with even frequency parameters. Following this general pattern you can create left-right symmetric butterflies with the head at the top of the wing area. The coefficients of the sine and cosine terms can be any real numbers, and there's no limit to how many sine and cosine terms you can have, or how large the frequency parameters are. However, not every combination of coefficients will produce a butterfly, so trial and error is necessary to get the shape just right. The butterfly graph at the top of this article is generated by the equation

r(θ) = 8 - sin(θ) + 2sin(3θ) + 2sin(5θ) - sin(7θ) + 3cos(2θ) - 2cos(4θ)

Here the constant term is 8. The sine function group is -sin(θ) + 2sin(3θ) + 2sin(5θ) - sin(7θ) with frequency parameters 1, 3, 5, and 7. The cosine function group is 3cos(2θ) - 2cos(4θ) with frequency parameters 2 and 4. The constant term and coefficients don't have to be integers, but the frequency parameters do.

Next we will see how varying the parameters of this function produces butterfly curves with different effects.

## Varying the Constant Term: Making the Butterfly Fatter

The magnitude of the constant term relative to the coefficients of the sine and cosine terms governs how delicate or meaty the butterfly is.

The set of graphs above depicts butterflies that have the same function except for the constant term.

In the set of three blue butterflies, the constant term ranges from 7 to 9 to 12. The butterfly with a coefficient of 7 looks more delicate than the other two; the butterfly with a coefficient of 12 looks fat. If you increased the constant term to 100 or 200, the graph would no longer resemble a butterfly, but would look more like a circle with dimples around the circumference.

In the set of four orange butterflies, the constant terms are 7, 9, 11, and 13. As the constant term increases, the butterfly becomes heftier. In the set of three green butterflies, the constant terms are 6, 8, and 10.

## Changing the Frequency Parameters of Sine and Cosine: Making Asymmetric Butterfly Curves

To make an imperfect butterfly with mismatched wings, you must adulterate the standard equation with terms of the form coeff*sin(even*θ) and/or coeff*cos(odd*θ).

The smaller the value of the coefficient relative to the other coefficients, the less noticeable the asymmetry. For example, adding 0.1sin(6θ) or -0.1cos(5θ) to the general equation will wobble the wings only slightly if the other coefficients have an absolute value greater than 1. Here are some examples of asymmetric butterfly curves in polar coordinates.

## Fractional Frequency Parameters: Making Double-Traced and Triple-Traced Butterfly Curves

To make the butterfly equation trace out in criss-crossing arcs, you must change at least one of the frequency parameters to a rational number that is not an integer. For double-traced butterflies, it requires half-integers, e.g., 1.5, 2.5, 3.5, 4.5, etc. For triple-traced butterflies you need to use third-integers, e.g., 5/3, 7/3, 8/3, 10/3, 11/3, 13/3, etc.

In order for an n-traced curve to come full circle, θ must range from 0 to 2nπ, so you will have to adjust the default on your graphing calculator or SVG program. Here are some examples of double- and triple-traced butterfly curves.

If one of the frequency parameters is set to an irrational number, the curve will never close on itself. An n-traced butterfly curve will not be perfectly symmetric, but the higher the value of n, the less noticeable the asymmetry is. The butterfly below is 5-traced, since the parameter 13.2 = 66/5.

## Large Frequency Parameters: Making Fuzzy Wing Effects

To add some fuzz around the wings, you must introduce sine and/or cosine terms with high frequency parameters. The higher the parameter, the tighter the fuzz. The larger the coefficient, the more pronounced it will be.

For example, adding the term 0.1cos(100θ) will produce denser fuzz than 0.1cos(50θ). Adding the term 0.8sin(49θ) will produce more pronounced fuzz than 0.1sin(49θ). Many examples are shown in the images above. In the last image, the double-traced fuzz effect is caused by the term 0.5e^cos(30.5θ).

## Alternative Polar Equation Forms for Butterflies

Functions of the form r(θ) = constant + sum{ coeff*sin(odd*θ) } + sum{ coeff*cos(even*θ) } are not the only ones that can produce butterfly curves. As long as the function is periodic without asymptotes, the function has the potential to produce a butterfly-shaped curve.

In the butterfly curve above, the sin(odd*θ) terms have been replaced with e^sin(odd*θ). The functions e^sin(x) and e^cos(x) are periodic, so they can be added to the basic form to produce polar equation butterfly curves.

If you add polynomial terms such as θ, θ^2, θ^3, etc. or pure exponential terms of the form b^θ, the curve will spiral outward and never close.

Even though the functions tan, cot, sec, and csc are periodic, they have asymptotes and therefore won't produce a closed curve either.

## Drawing Butterflies on a TI-84 Plus Graphing Calculator

Texas Instruments' TI-84 Plus graphing calculator has an easy-to-use interface for plotting functions in rectangular, polar, and parametric coordinates, and is the most commonly used graphing utility used in schools.

To draw butterfly curves on a TI-84 Plus, first set the graphing mode to polar coordinates by pressing the "Mode" key and selecting "Par" in the menu. Then, press the "Y=" key to access the function input screen. Enter the polar function, using the "XθTn" key to input the variable θ. In the window menu, make sure that the range of θ is at least [0, 2π]. If you used any terms of the form cos(θ*m/n) or sin(θ*p/q), then you'll need to increase the range to [0, 2kπ], where k is the least common multiple of the denominators of the fractional coefficients. For example, if you have sin(θ*37/15) and sin(θ*4/6) in your equation, then you need to set the θ range to [0, 60π], since the lcm of 15 and 6 is 30. Zoom in or out as necessary to view the entire butterfly.

## Comments

Very cool! Those poor asymmetric butterflies look like they got stepped on.

Here's my attempt at making one with a more defined head

http://s2.hubimg.com/u/8535681_f1024.jpg

r = 7 - sin(θ) + 2.3sin(3θ) + 2.5sin(5θ) - 2sin(7θ) - 0.4sin(9θ) + 4cos(2θ) - 2.5cos(4θ) + 3/sqrt[1+16sin(5θ)^2]

How did you get the Desmos calculator to add shading?

Thanks so much for this project. Works excellent on Ti-83 with polar coordinate setting.

So cool, I've seen hearts and flowers with this method, how do you make those shapes?

Really Cool. Thanks for sharing it.

So beautiful, will have to try it on my daughter's graphing calculator.

I'm in love

I'm not going to pretend I know anything about this. I think it is cool beans that you can create so many different shapes of butterflies on a graphing calculator.

thank this is exactly what i was looking for.

10