Jump to main content
Your email has not been verified. Verify email now ›

Design Your Own 3D Optical Illusions

Summary

Grade Range
8th-12th
Group Size
1-2 students
Active Time
2 hours
Total Time
2 hours
Area of Science
Pure Mathematics
Key Concepts
Functions, equations, graphing, plotting
Credits

Thanks to Mark Veillette, PhD, for helpful contributions and Python code.

Illusion based on the work of Dr. Kokichi Sugihara.

Science Buddies is committed to creating content authored by scientists and educators. Learn more about our process and how we use AI.

The object looks like an arrow pointing to the right, but its reflection seems to show an arrow pointing to the left.

Overview

In this lesson your students will design their own 3D objects that exhibit "anomalous mirror symmetry"—that is, their reflections appear flipped left to right when you put them in front of a mirror.

Students will start by defining the outline of a 2D shape using functions. They will then use MATLAB or Python code to convert the 2D shape into a 3D curve that replicates the outline of the 2D shape when viewed from a certain angle. Finally, they will convert the 3D curve into a solid 3D object that can be viewed on a computer or 3D printed.

Working MATLAB and Python code is provided. Your students do not need to write the code from scratch.

Learning Objectives

Common Core Alignment

CCSS.MATH.CONTENT.8.F.A.3: Grade 8: Functions: Define, evaluate, and compare functions.
Interpret the equation y = mx + b as defining a linear function, whose graph is a straight line; give examples of functions that are not linear.

CCSS.MATH.CONTENT.HSF.IF.C.7: High School: Functions: Interpreting Functions: Analyze functions using different representations.
Graph functions expressed symbolically and show key features of the graph, by hand in simple cases and using technology for more complicated cases.

Materials

Each student or group of students will need:

Optionally, the entire class will need:

Background Information for Teachers

This section contains a quick review for teachers of the science and concepts covered in this lesson.

The illusion in this lesson is based on the paper Anomalous Mirror Symmetry Generated by Optical Illusion by Dr. Kokichi Sugihara. You can read the paper for the complete details, but we will summarize it here.

The paper presents objects that appear flipped left to right when placed in front of a mirror. One such object is the "impossible arrow" (Figure 1). The shape only looks like an arrow when viewed from the correct angle. When viewed from the top or the side (Figure 2), it does not look like an arrow at all.

A 3D printed object in front of a mirror. Image Credit: Ben Finio, Science Buddies / Science Buddies

The object looks like an arrow pointing to the right, but its reflection seems to show an arrow pointing to the left.


Figure 1. The "impossible arrow" illusion. The arrow appears to point to the right, but its reflection in the mirror points to the left.

Top view of the 3D printed impossible arrow. It does not look like an arrow from this angle. Image Credit: Ben Finio, Science Buddies / Science Buddies
Side view of the 3D printed impossible arrow. It does not look like an arrow from this angle.  Image Credit: Ben Finio, Science Buddies / Science Buddies
Figure 2. Top and side views of the "impossible arrow" reveal that it does not look like an arrow at all when viewed from these angles.

This illusion works because your brain assumes the top of the object is flat. However, as shown in the side view in Figure 2, the top and bottom surfaces of the arrow are not flat. The shape of these surfaces is carefully defined so it looks like the outline of a two-dimensional arrow only when viewed from a certain angle.

Dr. Sugihara's paper describes how you can start with the outline of a 2D shape in the x-y plane, defined by top and bottom parametric curves a1 and a2 (Figure 3). The curves are defined over the interval [-1,1] as functions of the parameter t. They can be defined by piecewise functions, but they must be continuous and meet at their endpoints on the x-axis, forming a closed curve. They are not required to be symmetrical about the x axis, although the arrow in Figure 3 is.

2D plot of an arrow pointing to the right in the x-y plane, with top curve a1 and bottom curve a2. Image Credit: Ben Finio, Science Buddies / Science Buddies
Figure 3. A two-dimensional drawing of an arrow in the x-y plane, with top curve a1 and bottom curve a2.

The paper presents equations that convert these 2D curves into 3D curves that look like the 2D shape when viewed from an angle θ (Figure 4). The view angle is defined downward from a horizontal line that is parallel to the y-axis, so looking at the shape directly from the side would be a view angle of 0°, and looking at the shape from directly above would be a view angle of 90°.

A view of the y-z plane with the x axis pointing out of the screen. Image Credit: Ben Finio, Science Buddies / Science Buddies

A dashed line parallel to the y axis is offset in the positive z direction, with an angle theta defined downward from that line.


Figure 4. Definition of the view angle θ.

The equations to convert the the 2D curves a1 and a2 into 3D parametric curves c1 and c2 are:

Equation 1:

Equation 2:

where

Equation 3:

Note that since x = t for both c1 and c2, you can substitute x for t in the above equations if your students have not yet learned about parametric curves.

The resulting 3D curves c1 and c2 only look like the original 2D shape when viewed along the y-axis at a downward angle θ (Figure 5). When the shape is rotated 180°, its original orientation appears preserved (e.g., an arrow pointing to the right), resulting in the "anomalous mirror symmetry" illusion (Figure 6).

Views of the 3D curves c1 and c2. Image Credit: Ben Finio, Science Buddies / Science Buddies

All three views are aligned along the y axis but at three different downward view angles: 90 degrees, 45 degrees, and 0 degrees. The 2D arrow shape is only visible at the 45-degree view angle.


Figure 5. Views of the 3D curves c1 and c2 while changing the view angle θ.
Four views of the arrow outline with a downward view angle of 35 degrees Image Credit: Ben Finio, Science Buddies / Science Buddies

Rotations about the z axis of 0 degrees, 45 degrees, 135 degrees, and 180 degrees. The 2D arrow is only visible in the 0 degree and 180 degree views. In both cases it looks like the arrow is pointing to the right.


Figure 6. Views of the 3D curves c1 and c2 with a constant view angle θ=45° while rotating the shape about the z-axis.

While this is sufficient to generate the illusion in a 3D graph, if you want to 3D print the shape, you need to generate an STL file (originally developed for a type of printing called stereolithography). An STL represents the surface of a solid object using triangles. So, for example, an STL file of a cube will consist of twelve triangles, two on each of the six faces of the cube (Figure 7).

Two 3D plots of a cube. One has each face represented by a square. The other has each face broken up into two triangles. Image Credit: Ben Finio, Science Buddies / Science Buddies
Figure 7. Left: A cube plotted in 3D space. Right: An STL representation of the same cube, with each face broken up into two triangles.

A triangularized representation of the 3D shape based on the curves c1 and c2 can be created first by offsetting the curves in the z direction (Figure 8), then filling in the sides, top, and bottom of the shape with triangles (Figure 9). This results in a solid 3D version of the illusion (as opposed to a wireframe version) that can be viewed in a 3D graph or exported as an STL for 3D printing or further editing in a CAD program.

Plot of the original 3D curves c1 and c2 and additional curves with the same x y coordinates offset in the z direction Image Credit: Ben Finio, Science Buddies / Science Buddies
Figure 8. 3D curves offset in the z direction to create the top and bottom edges of the 3D shape.
3D plot of the impossible arrow shape with the surface filled in with triangles Image Credit: Ben Finio, Science Buddies / Science Buddies
Figure 9. 3D shape with the surface filled in with triangles.

In this lesson, your students will define their own 2D shapes using piecewise functions (linear, quadratic, polynomial, trigonometric, etc.—you can decide what is appropriate for your students). They will then enter their shapes into a working MATLAB or Python program that automatically generates the triangularized 3D version of the shape as shown in Figure 9, as well as the intermediate steps (as in Figures 5, 6, and 8). You can choose whether your students just view their shapes in the output MATLAB or Python plots (which can be rotated on the computer screen) or also 3D print them.

Additional Background Links

Prep Work (10 minutes)

Try running either the MATLAB or Python code yourself to see how it works. Both programs use the arrow shape as the default, but you can load a different predefined shape or define your own.

  • For MATLAB, download impossible_shape_generator.m, save it on your computer, and open it in the MATLAB editor. You can also download CSV files for the boat, fish, and car shapes from Dr. Sugihara's paper.
  • For Python, make a copy of this Google Colab notebook to your Google Drive. Google Colab is an environment that lets you run Python code directly in a web browser. You do not need to download anything.

Run the code one section at a time using either the Run and Advance button in the Section part of the MATLAB menu or the Run Cell button (which looks like a Play button) in the top left of each section in Google Colab. Read the on-screen instructions for each section.

Optionally, you can 3D print one of the default shapes (see instructions in the program to select one) or one that you design yourself to show your students.

Engage (10 minutes)

There are several ways to introduce this lesson to your students:

  • Run the MATLAB or Python code and show the output graphs on a projector. Rotate the graphs so students can see the illusion on the screen. (See Prep Work section.)
  • 3D print your own "impossible arrow" (or another shape you design yourself) before you start the lesson so the students can see the illusion in person. (See Prep Work section.)
  • Show this short video, which demonstrates the illusion but does not explain how it works.
  • Show this longer video, which provides an overview of how the illusion works and what the students will be doing.

Depending on how you introduce the lesson, have a brief discussion with your students. For example:

Ask:
What is the illusion that we are seeing? How does the illusion work?
Discussion tip:
The illusion is an arrow that always seems to point to the right, even when we spin it around. When we put the arrow in front of a mirror, its reflection appears to point to the left. The illusion works because your brain assumes the top of the arrow is flat, but in reality it has a complicated 3D shape. The illusion only works when we look at it from a specific angle.

Explore (2 hours)

  1. Explain that your students will generate their own 3D illusions. They will start by designing the 2D shape that will be visible in the illusion.

    To do this, they need to make a closed curve that defines the outline of the 2D shape. This closed curve is made from two separate curves in the x-y plane that are both functions of x: the top curve a1 and the bottom curve a2.

    Figure 10 shows an example: the outline of an arrow that is defined by piecewise line segments. (Remember that the shape does not have to be symmetric about the x-axis). You can reproduce this drawing on a chalkboard. It is also available as part of the slideshow that includes other figures from this lesson.

    Teacher Note: If you choose, you can introduce the curves as parametric functions of t instead of x (see Background section).

    2D graph of the arrow shape with equations defining the lines for the top half of the shape. Image Credit: Ben Finio, Science Buddies / Science Buddies

    The equations for the different segments of the curve, from left to right, are: y=5x+5; y=0.5; y=5x+1; y=-x-1


    Figure 10. Outline of a 2D arrow defined by piecewise line functions. Only the equations for the upper curve a1 are shown.
  2. Have your students use the Student Worksheet to design their 2D shapes. You can decide whether they start by sketching the shape and then defining functions for each section of the curves, or write the functions first and then graph the shape.

    Tell the students about the criteria for the curves (you can adjust the terminology as needed for your students):

    1. The shape must be made from upper and lower curves that are both functions of x (or parametric curves that are both functions of t and monotone in x).
    2. The two curves must meet at their endpoints on the x axis, (-1,0) and (1,0), forming a closed curve.
    3. The curves must be continuous. They do not need to be continuously differentiable.
    4. The curves do not need to be symmetric about the x- or y-axis.

    Teacher note: Dr. Sugihara's paper plots the shapes on the interval [-1,1] on the x-axis, as shown in Figure 10. If you would like to avoid having your students work with decimals, you can expand the domain—for example, to [-10,10]. The MATLAB and Python code will still work, but you may need to scale down the STL file when 3D printing, depending on the units. (A shape that goes from -10 to 10, for example, would be 20 inches long if imported in inches and would not fit in most printers.)

  3. After designing their shapes on paper and writing the piecewise functions for a1 and a2, students should plot the shapes in a spreadsheet program (Figure 11) by entering the appropriate domain for x (e.g., [-1,1] or [-10,10]) and entering equations to calculate the y values of the a1 and a2 curves using their piecewise functions. Alternatively, if your students know how to make plots in MATLAB or Python, they can make the plots there instead.

    Teacher Note: You can point out that the advantage of defining the shape using functions (instead of just plotting all the points manually) is that you can easily increase the resolution of the graph. If you plot the points by hand, then you must manually plot additional points if you want to increase the resolution. Functions can automatically calculate the y values of the new points for you if you put them in a spreadsheet.

    Screenshot of an Excel document with columns for the x and y coordinates of the curves a1 and a2. Image Credit: Ben Finio, Science Buddies / Science Buddies

    The y coordinates are defined by equations. On the right is a graph of the resulting arrow.


    Figure 11. Screenshot of spreadsheet program with the curves a1 and a2 calculated using piecewise functions.
  4. Have students export their spreadsheets as CSV files with three columns: the x coordinate, the y coordinate of a1, and the y coordinate of a2. Each column should have a header, with the data starting in the second row.
  5. Now have students run either the MATLAB code or the Python code and follow the on-screen instructions to load their CSV file. (Optionally, you can have the students run the program with the default arrow shape before loading their own CSV file.)
    1. For MATLAB, download impossible_shape_generator.m and open it in the MATLAB editor.
    2. For Python, make a copy of this Google Colab notebook to Google Drive. Google Colab is an environment that lets you run Python code directly in a web browser. You do not need to download anything.
  6. Have students run the code one section at a time, either using the Run and Advance button in the Section part of the MATLAB menu or the Run Cell button (which looks like a Play button) in the top left of each section in Google Colab.

    Discuss the output of each step as a class.

    Each program will output six figures. Figure 12 shows an example of the MATLAB output.

    1. Plot of the original 2D shape in the x-y plane.
    2. 3D plot of the curves c1 and c2.
    3. 3D plot of the original curves c1 and c2, and additional curves offset in the z direction, forming the edges of a 3D shape.
    4. 3D plot of all the vertices on the top and bottom edges of the 3D shape. These vertices will be connected with triangles to form the STL file.
    5. 3D plot of the surface triangles using Method 1. This method adds vertical triangles to form the side walls of the shape, then adds triangles connecting the opposite edges to form the top and bottom surfaces of the shape.
    6. 3D plot of the surface triangles using Method 2. This method adds vertical triangles to form the side walls (as in Method 1), but it connects triangles to a central point to form the top and bottom surfaces of the shape.
    Output figure of the MATLAB program showing the six graphs described in step 4 of the procedure for the impossible arrow shape. Image Credit: Ben Finio, Science Buddies / Science Buddies
    Figure 12. Example output of Figures 1–6 from the MATLAB program.
  7. Have students rotate the views of the various 3D graphs and discuss what they see.
    Ask:
    What do you see when the graph is first plotted?
    Discussion tip:
    Students should see the outline of their 2D shape.
    Ask:
    What do you see if you rotate the graph to view the shape from the top or from the side?
    Discussion tip:
    The illusion of the 2D shape should disappear.
    Ask:
    What happens if you return to the original view angle, then spin the shape around the z axis a full 180°?
    Discussion tip:
    You should see the original 2D shape again (e.g., an arrow that is still pointing to the right, even though you would expect it to now point to the left).
  8. Give students a chance to update their 2D shapes and see how this changes the resulting illusion. They can do this by saving a CSV file with a new name (so they can keep track of their iterations) and re-running the program. Note that each time you run the program MATLAB will save new STL files in the same directory as the m-file. (It will automatically increment the file names to avoid overwriting previous files.) Your web browser will prompt you to save the STL files from the Python script.
  9. Optionally, your students can open their STL files in a computer aided design (CAD) program. Tinkercad is a good free option for a beginner-friendly CAD program.
  10. If your class has access to a 3D printer, have your students 3D print their shapes. They can choose between Method 1 and Method 2 for the triangularization, depending on which they think looks best, or print both if you have the resources.
  11. Try viewing the 3D printed shapes from different angles and spinning the shapes around. When do you see the illusion? What makes the illusion disappear?
  12. Try putting the 3D printed shapes in front of a mirror and spinning them. Do you see the "anomalous mirror symmetry" illusion? Does the illusion work better for some shapes than others?

Reflect (15 minutes)

Have a "show and tell" session where students get a chance to see each other's shapes.

Assess

In addition to collecting your students' worksheets, you can ask them to submit their electronic files, including the CSV file, copies of the MATLAB or Python figures, and their STL file.

Make Career Connections

Discussing or reading about these careers can help students make important connections between the in-class lesson and STEM job opportunities in the real world.

Career Profile
Do you want to learn how to invent your own amazing optical illusions? Did you enjoy thinking about all the equations and graphs in this project? You can become a mathematician like Dr. Sugihara! Read more
Career Profile
Did you like working with the MATLAB or Python code in this project? Do you like creating computer programs that can do whatever you want them to? Learn more about becoming a computer programmer! Read more

Lesson Plan Variations

Top
Free science fair projects.