Parabolic Reflections

[Home]   [Puzzles & Projects]    [Delphi Techniques]   [Math topics]   [Library]   [Utilities]




Search WWW


As of October, 2016, Embarcadero is offering a free release of Delphi (Delphi 10.1 Berlin Starter Edition ).     There are a few restrictions, but it is a welcome step toward making more programmers aware of the joys of Delphi.  They do say "Offer may be withdrawn at any time", so don't delay if you want to check it out.  Please use the feedback link to let me know if the link stops working.


Support DFF - Shop

 If you shop at Amazon anyway,  consider using this link. 


We receive a few cents from each purchase.  Thanks


Support DFF - Donate

 If you benefit from the website,  in terms of knowledge, entertainment value, or something otherwise useful, consider making a donation via PayPal  to help defray the costs.  (No PayPal account necessary to donate via credit card.)  Transaction is secure.

Mensa Daily Puzzlers

For over 15 years Mensa Page-A-Day calendars have provided several puzzles a year for my programming pleasure.  Coding "solvers" is most fun, but many programs also allow user solving, convenient for "fill in the blanks" type.  Below are Amazon  links to the two most recent years.

Mensa 365 Puzzlers  Calendar 2017

Mensa 365 Puzzlers Calendar 2018

(Hint: If you can wait, current year calendars are usually on sale in January.)


Feedback:  Send an e-mail with your comments about this program (or anything else).

Search only




Problem Description

This is a mathematical exploration of the reflecting properties of parabolas. 

Background & Techniques

I read a note about "whispering galleries" the other day. which prompted me write this program to investigate the mathematics and illustrate the results.  Real world reflecting objects such as whispering chambers, parabolic microphones,  flashlight reflectors,  satellite dishes, etc. are paraboloids; 3 dimensional versions of parabolas formed conceptually by rotating a parabola about its axis of symmetry.   They all take advantage of the fact that rays of energy entering parallel to the axis will all be reflected to a common focal point or, conversely, light or other energy generators placed at the focal point will emit parallel rays.  

We will be considering a parabola as a 2 dimensional cross-sectional view of a  paraboloid.  The tasks are


Find the equation of a parabola opening to the left with its vertex at V and a focal length (FV) at point F.


Find the intersection point  (B) of an arbitrary parallel ray (AB)  striking the parabola.


Define the line tangent to the parabola at the intersection point (CBD)


,By definition, the angle of incidence (ABE) of a ray striking a surface is the angle between the ray and a line "normal" to the surface.  IWe'll need to draw the "normal" line segment (BE) perpendicular to the tangent line.


Finally, we'll draw the reflected ray from point B until it intersects the FV axis of symmetry, hopefully at point F.  The angle of reflection (EBF) of the line from B must be equal to the angle of incidence but on the other side of the normal line. .  

Equation of the parabola

A parabola is defined by a quadratic equation commonly expressed a y=ax2 + b x +c which opens upwards and crosses the y axis at c.  Point (0,c) is the vertex.  The focal point for such a parabola is at (0, 1/(4a)).    I wanted my parabola to have a horizontal axis opening to the left which made the mathematics somewhat harder.  Now X  depends on the independent variable Y.  I started with an equation from the Wikipedia article for a parabola opening to the right with vertex at (h,k) and focal length of  f as (y-k)2 = 4f(x-h).    To make it open to the left, we'll invert the x scale by putting a minus sign in front of the x term  making our starting equation  (y-k)2 = - 4f(x-h).  Converting to  ABC form, we get  x = (-1/4f)Y2 + (k/2f)Y - k2/4f + h  so a=-1/4f, b=k/2f,  and c=h--k2/4f.  I set the x coordinate of the vertex, h, to be a few pixels from the right edge of the image area and the vertex y coordinate, k, to be the vertical midpoint   of the image area.  The focal length, f, default to 100 pixels, but may be changed by the user. 

Intersection Point

Click in front of the parabola to create ray at height Y1.  We'll start drawing at the left edge of the drawing area and stop at the point where it intersects the parabola.  By definition then , x1= ay12 + b y1 +c.  We'll draw that line.  Multiple rays may be created.

Tangent Line

Using y as the independent variable, our parabola defined by
x = ay2 + by + c and the slope of the tangent line is the derivative m = dx/dy = 2ay + b.  If we define our tangent line by x = my + d, we need to find the value for intercept d.  Since line must pass through (x1,y1), x1 = my1+ d allowing us to evaluate d as d = x1- my1

Now we have almost enough information to plot the tangent line once we decide how long to make it.  I decided on 80 pixels in each direction from the ray intercept point. So we need to find the point  on the line x = my + d that is 80 units from (x1,y1). We want to find the deltas, Dx and Dy that satisfy the distance equation Dx2+Dy2=802.  Since our slope m = dx/dy anywhere on the tangent line, Dx = mDy  and we can substitute for Dx in the distance equation and get (Dym)2 +Dy2=6400.   This  implies Dy2*(1+m2) = 6400 and therefore  Dy = sqrt(6400 /(1+m2)).   Substituting back unto the line equation will give us Dx.  We can add and subtract  the D values to/from (x1,y1) to find the endpoints of the tangent line to be drawn.

Normal Line

Given that the slope of the tangent line is m, the slope of a  perpendicular line will be m2=-1/m.  We can find intercept d in line equation x = m2y + d by evaluating the end at ray intercept point (x1,y1), where d = x1-m2*y1.   Now we want to extend the normal line toward axis for 40 pixels.  To do this we'll use the same technique describe above for the tangent line length to find the point  on the line that is 40 units from (x1,y1). to derive that Dy = sqrt(1600/(1+m22) and  Dx = m2Dy. 

Reflection Line

Since we are using y as the independent variable,  the slope (dx/dy) of the tangent line is  relative to vertical and that is the best basis to calculate the rest of the angles.  In this diagram, we illustrate the  angles increasing  counterclockwise from the y axis to find the required angle of reflection. 

bulletTo BC is the known angle of the tangent. line because we have already calculated the slope, m, which is the tangent of the angle.  Lets call it theta, q = arctan(m)
bulletTo BA , the incoming ray, the angle is 90 degrees,
bulletTo BE, the normal line, the angle is q + 90
bulletThe angle of incidence is the difference between the normal and the ray angles which is (q + 90) -90 = q
bulletFinally, our angle to the reflected ray, BF, is the normal angle + the angle of incidence = (q + 90) + q = 90 +2q.     

So we'll set m3, the slope of reflected ray as m3 = arctan(90+2q).    We're almost home now.  As with our previous lines, we'll use the line equation  x = m3Y + d3 and find d3 by evaluating at the known (x1,y1) intersection point. d3 = x1 - m3y1.  We'll extend the line to the point where it crosses the parabola axis at y=k. making    x3 = m3*K + d3.   If we are lucky and implemented the math correctly, the end point of the reflected ray will land exactly on the focal point,.  Sure enough, that appears to be the case. 

The above step by step derivation seems quite logical now.  If I said that was way to problem was solved, I'd be lying.  Recognizing that making Y the independent variable had logically rotated all of the slopes and angles by 90 degrees took several days.  Much time was spent trying to replace tangent functions with cotangents.  Only after the rays were converging on the focal point did I backtrack to understand  why.  In the meantime, thanks to trig identities, here are a few additional "trial and error"  ways to calculate the slope which all produce the correct result.

m3 = -cot(2arctan(m));
m3 = -tan(pi/2 - 2arctan(m));
m3 = tan(2arctan(m) - pi/2);
m3 = cot(2*arctan(-m));
m3 = -tan(pi/2 + 2*arctan(-m));
m3 = tan(- 2arctan(1/m) - pi/2);

Notes for programmers

The code is a quite straightforward implementation of the above description and quite well commented.  The images are drawn using the OnPaint exit of a TPaintbox control 

Clicks on the image to generate rays are saved as an array of points where the rays intersect the parabola.  The OnPaint exit clears the image and redraw the parabola and all of the currently defined rays using the current draw options. 

Running/Exploring the Program 

bullet Download source
bullet Download  executable

Suggestions for Further Explorations

The program  currently is not very informative about the math being applied.  Features could be easily added to display the parameters (intercepts, distances, and  angles),  and the calculations which produced them for any selected ray.

Original Date: April 30, 2009

Modified: May 15, 2018


  [Feedback]   [Newsletters (subscribe/view)] [About me]
Copyright 2000-2018, Gary Darby    All rights reserved.