25
$\begingroup$

I'm trying to define $\pi$ in terms of $4$ by placing a unit circle inside a square, and subtracting the corners of the square.

I'm attempting to use summation to define the area of a corner, then multiplying that by four and subtracting from four (the area of the square)

I thought I figured it out, and I created a program to check. The answer came out to $\approx 3.4$

I'm not sure if it was a program fault, or if I'm simply making a math error. Can someone please lead me in the right direction? This is what I have right now:

$$\pi \approx 4 \times \left(1-\sum\limits_{n=1}^{\infty}\frac{\left(\frac{2-\sqrt 2}{2}\right)^2}{2^{n-1}}\right)$$

Where $\left(\frac{2-\sqrt2}{2}\right)^2$ is the area of the largest corner square and $2^{n-1}$ is the number of squares.

EDIT

After reading the comments I realized I wasn't very clear with what I was trying to achieve, so I created a sketch that should illustrate what I want.

$\endgroup$
  • 1
    $\begingroup$ What's the theory behind that summation? $\endgroup$ – Chris Culter Dec 14 '14 at 9:11
  • 2
    $\begingroup$ How do you do the summation? right hand side equals $4-(2-\sqrt{2})^2\frac{\pi^2}{6}$, it seems something is not quite good with your summation. $\endgroup$ – user201043 Dec 14 '14 at 9:16
  • 3
    $\begingroup$ Well, this is what I was going for $\endgroup$ – David Dec 14 '14 at 9:21
  • 2
    $\begingroup$ Thanks, the sketch helps! At each level of the construction, there are $2^n$ squares, not $n^2$. The blue squares are larger than $1/4$ the area of the red corner square; they would be $1/4$ the area only if the slope of the circle were a constant $45^\circ$, like a regular octagon. The green squares aren't all equal; the two in the middle are smaller than the two on the outside. $\endgroup$ – Chris Culter Dec 14 '14 at 9:29
  • 1
    $\begingroup$ @David Wow I didn't know that sketch website existed ... seems very useful! $\endgroup$ – Zubin Mukerjee Dec 14 '14 at 9:46
24
$\begingroup$

As I mentioned in the comments, the sizes of the squares are a little more complicated than what you're hoping for. I don't know of a simple expression for the size of each square, but you can get each one by solving a quadratic equation. I wrote a program to do so; it draws all the squares whose sizes are above a small threshold. Here's the result. Hope it helps!

Details on the program: for a point $(0,0)\leq(x,y)\leq(1,1)$, we want to find a square with one vertex at $(x,y)$ and the other on the sphere $x_0^2+y_0^2=1$. Writing $b=y-x$, the condition that the two points form a square means that $y_0=x_0+b$. Substituting, we get $2x_0^2+2bx_0+b^2-1=0$. The solution is given by the quadratic equation: $x_0=\frac14\left(-2b+\sqrt{4b^2-4(2)(b^2-1)}\right)$, and then we get $y_0$ from $y_0=x_0+b$. Now draw the square between $(x,y)$ and $(x_0,y_0)$ and repeat the process from each of the points $(x,y_0)$ and $(x_0,y)$.

Here's some C++ code to generate an SVG fragment:

using namespace std;

void box(double x1, double y1, double x2, double y2, int level)
{
    cout
    << "<rect x=\"" << min(x1, x2)
    << "\" y=\"" << min(y1, y2)
    << "\" width=\"" << abs(x1-x2)
    << "\" height=\"" << abs(y1-y2)
    << "\"";

    switch (level % 3)
    {
        case 0: cout << " fill=\"red\""; break;
        case 1: cout << " fill=\"green\""; break;
        case 2: cout << " fill=\"blue\""; break;
    }

    cout << " />" << endl;
}

void boxes(double x1, double y1, double x2, double y2, int level)
{
    double r = 300.0;

    x1 *= r;
    y1 *= r;
    x2 *= r;
    y2 *= r;

    box(r+x1,r+y1,r+x2,r+y2, level);
    box(r+x1,r-y1,r+x2,r-y2, level);
    box(r-x1,r+y1,r-x2,r+y2, level);
    box(r-x1,r-y1,r-x2,r-y2, level);
}

void advance(double x, double y, double& ox, double& oy)
{
    const float b = y - x;
    ox = (-2*b + sqrt(4*b*b - 8*(b*b-1))) / 4;
    oy = ox + b;
}

void drawlevel(int level, double x, double y)
{
    double ox, oy;
    advance(x, y, ox, oy);
    boxes(x, y, ox, oy, level);

    if (abs(x-ox) > 0.0004)
    {
        drawlevel(level + 1, x, oy);
        drawlevel(level + 1, ox, y);
    }
}

int main()
{
    drawlevel(0, 1, 1);
}
$\endgroup$
  • $\begingroup$ Beauty is part of mathematics ! You gave one more proof. Thanks. $\endgroup$ – Claude Leibovici Dec 14 '14 at 13:09
  • $\begingroup$ Do you mind sharing how your program works? I'm not sure how to go about the quadratic equation you mentioned. $\endgroup$ – David Dec 14 '14 at 18:56
  • $\begingroup$ Thanks for explaining the code. How could I implement that in my expression? $\endgroup$ – David Dec 15 '14 at 0:07
  • $\begingroup$ Sorry, I don't know how to write down the result of this process in a simple expression. I suppose you could try solving the first few iterations and looking for a pattern. $\endgroup$ – Chris Culter Dec 15 '14 at 0:46
  • $\begingroup$ +1. Quite ingenious. I like very much your $\verb*C++*$ code. What $\verb*C++*$ library you include to use colors ?. $\endgroup$ – Felix Marin Dec 23 '14 at 21:39
0
$\begingroup$

Your way of filling the corners will only (as far as I can see) a triangular part of them.

It's going to be hard to fill them with squares.

Chris says the same in his comment except that he actually tries to tell you what you might do (and he caught you miscounting on the number of smaller squares in each step).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.