callumneily

140 Reputation

2 Badges

1 years, 119 days

MaplePrimes Activity


These are Posts that have been published by callumneily

Suppose you place two points on the x-y plane and ask a seemingly simple question: What is the shortest path connecting them?

The "obvious" answer is a straight line (the green curve), but how can we show that this is truly the optimal path? Imagine two fixed points (x1,y1) and (x2,y2) connected by some curve y(x).

To find the length of this curve, we zoom in on an infinitesimally small segment. If the curve changes by small amounts dx horizontally and dy vertically, then the Pythagorean theorem gives the tiny arclength ds:

Here, y' = dy/dx is the derivative/slope of y(x) with respect to x. The total length S of the curve, often referred to as the "action", is found by integrating these arclengths:

Notice that, unlike ordinary functions that take numbers as inputs, S[y] takes an entire curve y(x) as input and outputs a single number, S. Such a function is called a functional.

Our goal is to find the curve y(x) that minimizes the length S[y]. Instead of asking how the function (or "functional") S[y] changes for some change in x, we must ask how the total path length changes if we slightly deform the curve y(x) itself. This is the central idea behind a branch of calculus called "Calculus of Variations".

Let's predict that the shortest path between two curves is y(x). Without knowing that y(x) is a straight line (we haven't proved this yet!), our first prediction is probably incorrect. So, let's say the true ideal path is a nearby path y(x) + ε*η(x), where η(x) is the shape of the function that corrects our original prediction, and ε scales this correction function (i.e. controls how large the deformation is). To ensure that the endpoints remain the same, we require η(x1) = η(x2) = 0.

Substituting this new path into the expression for S[y] above, we get the path length S as a function of ε:

Notice that if ε = 0, we recover the original path y(x). If the original path does minimize S, then S has a minimum at ε = 0. That is,

So, to find the minimizing curve y(x), we find a curve y(x) such that dS/dε = 0 at ε = 0. Bringing the derivative inside of the integral for S[y] and using the chain rule, this means:

We can integrate this by parts using the substitutions:

Since we originally defined η(x1) = η(x2) = 0, the first term on the right disappears. We're left with:

Now, this must be true for any η(x) we choose, meaning:

Squaring both sides and rearranging to solve for y', we get that:

Hence, y(x) has a constant slope and is therefore a straight line. Note that there are multiple ways to prove that the shortest path between two points is a straight line (such as using the Triangle Inequality or algebraic arguments under Euclidean geometry), but this method of using least action has proven to have much deeper physical significance to more sophisticated questions, as discussed below.

As many of you have probably noticed, this argument only holds in flat Euclidean space (the space most of us are used to, like the xyz plane). In curved spaces, the analogue of a straight line is called a geodesic.

The general idea is still the same, but the formula for distance changes depending on the geometry of the space.

For example, consider the surface of the Earth. If you want the shortest route from Toronto to London while remaining on Earth's surface, you don't follow what looks like a straight line on a flat map. You follow part of a "great circle".

On a sphere of radius R, for example, the infinitesimal distance is given using spherical coordinates:

So instead of minimizing the flat-space length

we minimize:

Applying the same calculus-of-variations machinery gives the geodesics of the sphere, which turn out to be great circles.

This becomes especially interesting in general relativity. Spacetime itself is curved, and free-falling objects follow geodesics through that curved spacetime. In that sense, Earth's orbit around the Sun can be thought of not as Earth being forced away from a straight path, but as Earth following the natural geodesic of curved spacetime.

What we proved above is a remarkable fact, as the idea of minimizing the "action" functional is a fundamental characteristic of systems in nature. Instead of minimizing distance, physical systems obey the same mathematics to minimize quantities involving energy and time. For example, a hanging rope will form a shape called a catenary (a type of hyperbolic cosine function) to minimize its gravitational potential energy, not a parabola (which approximates the motion of projectiles) as one might think.

Similarly, light bends when moving between materials like air and water to minimize travel time.

So, never doubt the power of seemingly "simple" or intuitive mathematical results, as this elementary question of minimizing distance between two points uses the same mathematics that governs planetary motion, quantum fields, and spacetime itself!

Imagine walking into a room full of strangers. At first, everyone seems completely unrelated, with different names, different lives, and different birthdays. As the room gets more crowded, we of course know that sharing similarities with the strangers in the room becomes more likely.

But just how likely is it that, for example, two people in the room share a birthday?

The Birthday Paradox asks, more specifically: How many people must be in the room so that it is more likely than not that two people share a birthday?

Intuitively, we might imagine it must be well over 100 since there are 365 possible birthdays that each stranger can have. Probability, however, has a habit of ignoring our intuition.

Suppose there are only two people in the room: you, and one stranger. You have your own birthday, so there is a 1/365 ≈ 0.27% chance that the stranger next to you shares your birthday. If we add a third person to the room, we must consider the probability that either of the two strangers share your birthday, or the two strangers share a birthday with each other. This overlap makes our calculations more difficult, and it will only get worse as we add more people.

Instead, there's a cleaner way to find the solution. Let's find the probability P(n) that no two people share a birthday, then subtract it from 1 to get the probability that two people do share a birthday. Once P(n) < 0.5, then 1 - P(n) > 0.5, meaning at this value of n, there is a greater than 50% chance that two people in the room share a birthday.

For the case of only two people, there is a 364/365 chance that the second person has a different birthday than the first person. If we introduce a third person, there are 363 unclaimed birthdays left in the year, so a 363/365 chance that the third person's birthday falls on one of these days. Repeating this process for n people in the room, we get:

If we keep increasing n, we see that the probability P(n) that two people don't share a birthday decreases, meaning the probability 1 - P(n) that they do share a birthday increases.

Below are some values of 1 - P(n) I found using Maple Learn:

Based on these calculations, we see that when 23 people are in the room, it is more likely than not that at least two people in the room share a birthday.

Our question was very specific: we wanted to know what n needed to be in order for the probability of two people sharing a birthday to be > 50%. We found this number to be 23. But, we could extend this question to, say, the probability being 99.9%. This happens when there are 70 people in the room. Consider the animation below to see this visually, where the x-axis represents the number of people n, and the y-axis represents the probability that two people share a birthday, 1 - P(n):

How many people must be in the room to guarantee that two of them share a birthday? By the shape of the graph above, it may be tempting to think that it is impossible to guarantee this, since the probability seems to asymptotically approach 1. However, we must think through this logically.

If 365 people were in the room, it is still possible that their birthdays would all fall on a different day (although it's extremely unlikely). But if we have more people than we have available birthdays, we can say at least two people will share a birthday with 100% certainty. That is, P(n) = 0 when n > 365, so our formula for P(n) above is limited to values of n that are 365 or less. This is a basic principle in mathematics called the "pigeonhole principle", which uses the analogy that if we have more pigeons than we have holes to put them in, then at least one of the holes must have at least two pigeons.

These ideas can be conceptually confusing, but once you go through the mathematical arguments a few times, mentioning the Birthday Paradox in a conversation is a great way to show off your random math knowledge and confuse your peers!

Attached is an interactive Maple worksheet from Maple's Math Apps gallery if you'd like to investigate the Birthday Paradox further: The_Birthday_Paradox.mw. If you're still interested in more info/applications, see this Maple Primes post by John May.

Mathematics often feels precise and deterministic. We solve equations, follow logical steps, and do our best to arrive at exact answers. But sometimes, surprisingly, randomness can also lead us to deep mathematical truths. One of the most famous examples of this idea is a problem from the 18th century known as Buffon’s Needle.

Imagine you have a floor made of long wooden planks placed side by side. The seams between the planks form a set of equally spaced parallel lines across the floor. Now, suppose you take a needle and randomly drop it onto the floor. Sometimes the needle lands entirely on one plank. Other times, it crosses one of the seams between planks, as shown below.

Now here is the curious question posed by the French mathematician Georges-Louis Leclerc, Comte de Buffon in the 1700s:

If we repeatedly drop the needle at random, what is the probability that it crosses one of the lines on the floor?

At first glance, this sounds like a simple probability puzzle. But the answer turns out to involve one of the most famous numbers in mathematics: π.

To keep things simple, assume the distance between the parallel lines on the floor is the same as the length of the needle. We can also imagine that all of our needles are thrown onto the same plank, potentially crossing onto the plank above or below. This configuration is equivalent to throwing the needle onto any plank as long as the planks are equally wide; this modification makes the analysis much simpler.

Every time the needle lands, two things determine whether it crosses a line:

  • The distance x from the center of the needle to the nearest line
  • The angle θ at which the needle lands with respect to the parallel lines

See a depiction of this below.

To determine the probability of a needle crossing one of these lines, we need to describe what a "random drop" of the needle means mathematically. If the lines are the same length apart as the length of the needle L, then the center of the needle can never be farther than L/2 from the nearest line. Therefore, 0 ≤ x ≤ L/2. Next, we can simplify our domain for θ. The problem is symmetric, so we only need to consider angles between 0 and π/2. Any given half of the needle then has a vertical reach of (L/2)sin(θ).

We will say a needle "crosses" a line precisely when the center lands close enough to a line that one end of the needle can reach across the line. This occurs when x ≤ (L/2)sin(θ).

An important assumption to make is that every pair (x,θ) in the rectangle 0 ≤ x ≤L/2, 0 ≤ θ ≤ π/2 is equally likely. We’re assuming the needle lands with uniform randomness over all vertical positions x and angles θ. This means that the probability of crossing a line is the fraction of this region where the inequalities above hold. That is, 

Probability = (area of favourable region) / (area of total region)

The "rectangle" formed by inequalities has a total area of (L/2) * (π/2) = π*L/4. The needle crosses a line exactly when x ≤ (L/2)sin(θ), so for a fixed angle θ, the allowable x values are 0 ≤ x ≤ (L/2)sin(θ). The favourable area is then:

The probability of a needle crossing a line is therefore:

This result leads to a fascinating idea. If the probability of crossing a line is 2/π, we can rearrange the formula to estimate π itself:

π ≈ 2N / C

where:

  • N = the total number of needle drops
  • C = the number of times the needle crosses a line

In other words, by performing a simple random experiment and counting how often the needle crosses a line, we can approximate π.

For example, suppose you drop the needle 10,000 times and it crosses a line 6,366 times. Plugging these values into the formula gives

π ≈ (2 × 10,000) / 6,366 ≈ 3.14

With enough trials, the estimate tends to get closer and closer to the true value of π. At the bottom of this post, I attached a Maple worksheet that simulates this phenomenon. Below are results from simulating this result using N = 10, 100 & 1000, respectively. Notice as N increases, our approximation for π tends to become more and more accurate.

Below is a more dynamic simulation from the Maple worksheet to show how the approximation stabilizes as N increases.

What makes Buffon’s Needle so fascinating is the unexpected connection between geometry, probability, and one of mathematics’ most important constants.

π usually appears when dealing with circles (circumference, area, rotation, etc). But in Buffon’s experiment, there are no circles at all. Instead, π emerges from the geometry of all the possible ways a needle can land on a set of parallel lines.

This was one of the earliest examples of what we now call a Monte Carlo method, which is essentially using random experiments to estimate numerical values. Today, similar techniques are used in physics, finance, computer graphics, and machine learning.

One of the best parts of Buffon’s Needle is that you can try it yourself. All you need is:

  • A toothpick or needle
  • A piece of paper with a sequence of parallel lines, each a distance of the needle's length apart
  • A lot of patience

Drop the needle repeatedly (N times), record how many times it crosses a line (C), and compute 2N/C. The more times you repeat the experiment, the closer your estimate will get to π.

After reading about this experiment, I was convinced that mathematics is not only about abstract symbols and formulas. Sometimes, even something as simple as dropping a needle onto the floor can reveal the hidden structure of elements of the universe that we would've otherwise never known were there.

 

Buffons_Needle_Simulation.mw

Gabriel’s Horn is one of the most famous examples in calculus of how infinity can behave in ways that completely defy our intuition.

The horn-shaped object is created from a very simple curve: y = 1/x for x ≥ 1 (pictured below).

Now imagine rotating this curve around the x-axis. The resulting surface stretches infinitely far to the right while becoming thinner and thinner. Visually, it resembles a long trumpet or horn that continuously narrows to a thickness of zero.

At first glance, nothing about this shape seems particularly mysterious. As x grows larger, the radius 1/x becomes smaller and smaller. It seems reasonable that both the volume contained inside the horn and the area of its surface would remain finite (or at least if the volume was finite, then the surface area would also be finite). After all, the horn gets extremely thin very quickly.

Calculus allows us to test that intuition.

To compute the volume of the horn, we use the disk method. Each slice perpendicular to the x-axis forms a circular disk of radius r = 1/x, each with an area of π*r2 = π*(1/x2).



The total volume is the sum of an infinite number of these disc areas with thickness dx. As an integral,

V = π ∫₁^∞ (1/x²) dx.

This is a simple integral that converges to a value of 1. We could use the power or rule or our favourite computing software (I used Maple below).



Hence, V = π ∫₁^∞ 1/x² dx = π*1 = π. This means the horn contains only π cubic units of space, even though it extends infinitely far. 

Now let’s compute the surface area of the horn. For a surface of revolution, the surface area is

A = 2π ∫₁^∞ y √(1 + (y′)²) dx.

Since y = 1/x, we have y′ = −1/x². Substituting into the formula gives

A = 2π ∫₁^∞ (1/x) √(1 + 1/x⁴) dx.

Software like Maple can easily handle this integral. It tells us the integral diverges to infinity.

However, this is difficult to solve analytically. To understand what happens to this integral, notice that for large x, the square root term is very close to 1, since 1/x4 can be approximated as 0 as x grows large. This means the integrand behaves roughly like 1/x (it's actually slightly larger than 1/x). But

∫₁^∞ 1/x dx diverges, and ∫₁^∞ (1/x) √(1 + 1/x⁴) dx > ∫₁^∞ 1/x dx, so ∫₁^∞ (1/x) √(1 + 1/x⁴) dx must also diverge. As a result, the surface area of Gabriel’s Horn is infinite.

This leads to the famous, surprising conclusion:

  • The horn has finite volume.
  • The horn has infinite surface area.

In other words, it could be filled with a finite amount of paint, but it would require an infinite amount of paint to coat its inside surface.

Of course, real paint has thickness, so the paradox disappears in the physical world. Eventually, the horn would become thinner than the paint layer itself. But mathematically, the result is perfectly consistent.

The key idea lies in how quickly the function 1/x shrinks. The cross-sectional area of the disks scales like (1/x)² = 1/x², and the integral of 1/x² converges.

But the circumference of each slice scales like 1/x, and the integral of 1/x diverges.

So as the horn extends outward, the added volume decreases quickly enough to sum to a finite value, while the added surface area decreases too slowly and accumulates forever.

Gabriel’s Horn beautifully illustrates one of the central themes of calculus: infinite processes can produce results that feel deeply counterintuitive.

Volume and surface area seem closely related, but can behave in completely different ways when infinite limits are involved. A shape can stretch endlessly yet still contain a finite amount of space.

This strange object reminds me that mathematics isn’t just about calculating numbers, but is also about exploring the strange and fascinating consequences of simple ideas pushed to their limits.

 

In mathematics, us humans love to rely on intuition. It helps us make physical sense of phenomena and guide our thinking before formal reasoning is developed.

For example, approximating the derivative of a function at a point can be thought of intuitively as dividing the function’s rise by its run. As we shorten the distance we run, this ratio approaches the value of the function’s derivative at that point. See this in the demonstration from Maple Learn below.

 

It is impossible to fully grasp the idea of moving an infinitesimal distance, so we make it easier by asking: “If we move an extremely small distance to the right, how much do we move up?”.

Intuition is typically a beautiful tool for approximating limits, but limits tend to limit (pun intended) the utility of our intuition. A perfect example of this? The Staircase Paradox.

Consider any rectangle you’d like. In the following example, we'll use a rectangle of width 3 and length 4 for convenience, but this paradox extends to any rectangle.

The name of the game is to ask yourself: how far must we walk along the edge of the rectangle to get from the top left corner to the bottom right. Here, the distance is of course 7 units (3 units right and 4 units down). This looks like a bit of a scary fall, so let’s add some stairs.

Even with the stairs, we’re still travelling a total distance of 7 units (1.5 + 1.5 units right, 2 + 2 units down). To shorten the fall even more, we can keep adding more and more stairs.

The important thing to notice is that no matter how many stairs we add, the distance travelled is always 7.

Now you may be wondering, where exactly is the paradox? Well, imagine now we have an infinite number of stairs. Our intuition tells us that our path to the bottom becomes more like a slide instead of a staircase. The steps we take are infinitely small, so it seems like we’re just travelling in a straight line down to the bottom right corner. However, if this were the case, we would have a right triangle! Using the Pythagorean Theorem, the length of our travelled path would be sqrt(32+42) = 5.

In other words, our calculations from before were wrong! But... they can’t be wrong, because we saw that the total distance of 7 units travelled was independent of the number of stairs we added.

This is a consequence of something called the “Manhattan distance”, which is the distance you travel if you can only move horizontally and vertically, like navigating the grid of streets in Manhattan. No matter how small we make the steps in our staircase, we are still only moving right and down. We never actually move diagonally. So even though the staircase looks more and more like a straight line, its length is always computed using horizontal distance + vertical distance. The limit of the shapes is a diagonal line, but the limit of the lengths is not the length of that diagonal. And that’s where our intuition stumbles.

The key lesson of the Staircase Paradox is that a sequence of curves can converge to a straight line, while their lengths converge to something completely different.

This is one of the quiet but profound messages of higher mathematics: limits preserve some properties, but not all. Smoothness, shape, and position may converge nicely, while quantities like length, area, or curvature behave in more subtle ways. Mathematics has a gentle way of reminding us that how we measure something can matter just as much as what we’re measuring.

1 2 Page 1 of 2