Wikipedia:Reference desk/Archives/Mathematics/2010 October 16

= October 16 =

1/n in base b
Hello all I have been working with the behavior of 1/n in base b of and on for some time and recently had a breakthrough in understanding of how long the period of 1/n in base b for n coprime to b. What I found in essence is that for m=1,2,3,... the first m for which $$b^m-1$$ is divisible by n is precisely the period of 1/n in base b. My question is, given that this is closely related to Fermat's little theorem, any seen this conjecture before? Has it been proven? A math-wiki (talk) 01:19, 16 October 2010 (UTC)
 * I'm a bit puzzled by your question. Do you mean by "period" the length of the string of digits which repeats when 1/n is represented in base b?  --TeaDrinker (talk) 04:46, 16 October 2010 (UTC)
 * Midy's theorem might be of interest to you. Also, the phenomenon you mentioned can be explained by using standard long division. The intermediate remainder after k digits have been computed is b^k mod n. I'm sure a quick induction can prove this rigorously. Writing it out for 1/7 in base 10 is a convenient example case. If this value is 0, division terminates--this can only occur if b and n are not relatively prime (a basic number theory result I'm sure you can prove or someone can dig up). If this value is 1 (which must occur at some point when they're relatively prime, which is a consequence of Fermat's little theorem), and only when it is 1, the operation repeats itself. This occurs precisely when b^k = 1, i.e. when b^k - 1 = 0, for k > 0 as small as possible, where equality is taken mod n. 67.158.43.41 (talk) 06:04, 16 October 2010 (UTC)
 * Thus, the short answer is: Your observation is not just a conjecture; it is a well-known old result. However, it still is nice that you observed this on your own. JoergenB (talk) 21:28, 18 October 2010 (UTC)

Factorise this polynomial....
Can someone please tell me how to factorise x^3-4x+1 modulo 229? I really need to know this for some other problem but I don't want to compute it. I know it's a perfect cube modulo 229 but nothing else. I want its exact factorization modulo 229. Urgent help required. Thanks! —Preceding unsigned comment added by 180.200.136.222 (talk) 03:00, 16 October 2010 (UTC)

Mathematica gave $$(x+200)^2(x+58)$$.174.29.63.159 (talk) 04:56, 16 October 2010 (UTC)

That can't be. I know for a fact that it's a perfect cube. There must be an error. —Preceding unsigned comment added by 180.200.136.222 (talk) 05:12, 16 October 2010 (UTC)


 * I disagree.... Brute force shows 1, 94, and 134 are the only numbers mod 229 which, when cubed, are 1. Any $$(Ax + a)^3 = A^3 x^3 + 3a A^2 x^2 + 3a^2 A x + a^3 = x^3 + 0 x^2 - 4 x + 1$$ forces a^3 = A^3 = 1, giving only 9 possibilities. None of these satisfies 3a A^2 = 0. Edit: I forgot to mention 229 is prime, so for any B and k>0, B^k = 0 only for B=0 mod 229. This prevents terms higher than linear order from appearing inside the (Ax + a) term above. 67.158.43.41 (talk) 06:27, 16 October 2010 (UTC)

You don't have to take my word for it. Just verify it yourself. Foil it out and you get $$x^3+458x^2+63200x+2320000$$ and then do simple division on each of the coefficients and you get what you are supposed to get. 458 gives you remainder zero. 63200 gives you remainder 225 (which is -4 mod 229). And 2320000 is 1 mod 229. Done! 174.29.63.159 (talk) 08:06, 16 October 2010 (UTC)

Ah right. Sorry for the confusion. You're right. I was a bit confused. There's this theorem which states it has to have at least one factor with exponent GREATER than 1. I thought the theorem stated it had to be a perfect cube. Obviously different things. My mistake. Would you please tell whether there's an online tool that can factor such things modulo a given prime. It'd be really handy. Thanks! —Preceding unsigned comment added by 180.200.136.222 (talk) 09:01, 16 October 2010 (UTC)


 * Wolfram Alpha will do this if you type "factorise x^3-4x+1 modulo 229". —Preceding unsigned comment added by 130.88.123.142 (talk) 12:53, 18 October 2010 (UTC)

Another question: can you tell me a prime p such that x^3-4x+1 is a product of three distinct linear factors mod. p? I can tell you that the polynomial x^3-4x+1 is either irreducible mod. p, has exactly one root mod. p, or is a product of three distinct linear factors mod. p EXCEPT when p=229. So you just need to check when it has three distinct roots mod. p. Can you tell me a prime p when x^3-4x+1 has three distinct roots mod. p? Thanks! —Preceding unsigned comment added by 180.200.136.222 (talk) 09:20, 16 October 2010 (UTC)

Please help. I really need your help. —Preceding unsigned comment added by 180.200.136.222 (talk) 09:37, 16 October 2010 (UTC)

Anyone??? —Preceding unsigned comment added by 180.200.136.222 (talk) 11:47, 16 October 2010 (UTC)


 * Using my formula above, the cube of a linear factor Ax+a has 3a A^2 as the coefficient of the quadratic term. This must be 0, mod p. Since the integers mod n are a field for prime n=p, they have no zero divisors. That is, 3a A^2 = 0 (mod p) forces 3, a, or A = 0. a or A = 0 won't work since then the cubic or constant term is zero when it should be 1. So, 3=0. That is, p=3. However, then the linear term 3a^2 A x has 3a^2 A = 0, yet it should be -4 = 2. So, nope, looks like you can never make your cubic equation a cube modulo any prime. 67.158.43.41 (talk) 00:16, 17 October 2010 (UTC)

Sorry, you misunderstood me. I wanted to know whether you can make x^3-4x+1 a PRODUCT OF THREE DISTINCT LINEAR FACTORS modulo some prime p. I didn't want it to be a cube modulo p. In fact it's impossible as you say. So is x^3-4x+1 a product of THREE DISTINCT LINEAR factors modulo some prime p? Thanks for all you help. It's much appreciated. But please tell me the answer. —Preceding unsigned comment added by 180.200.136.222 (talk) 03:38, 17 October 2010 (UTC)


 * $$(x-8)(x-13)(x-16) = x^3 -37x^2 + 440x - 1664 = x^3 - 4x + 1 \mod 37$$
 * $$(x-5)(x-19)(x-29) = x^3 -53x^2 + 791x - 2755 = x^3 - 4x + 1 \mod 53$$
 * $$(x-26)(x-156)(x-164) = x^3 - 346x^2 + 33904x - 665184 = x^3 - 4x + 1 \mod 173$$
 * etc. Gandalf61 (talk) 09:27, 17 October 2010 (UTC)

Posterior distribution of lambda
Hi again, this time I have a question which has nothing to do with complex numbers!

Suppose $$X\sim Poisson(\lambda)\,$$ and our prior knowledge about $$\lambda$$ is $$\Gamma (\alpha,\beta)$$

i) Identify the posterior distribution of $$\lambda$$ given an observation x.

ii) One possible loss function is $$L_1=(a-\theta)^2$$. Show when the loss is minimised. What is an expression of this for the above posterior distribution?

By the way, I actually haven't started the introductory statistics course yet, but I know what poisson and gamma distributions are, as well as loss functions, but not how solve problems like this. This question is from a past exam.--MrMahn (talk) 06:58, 16 October 2010 (UTC)
 * $$\Gamma (\alpha,\beta)$$ could mean the density is proportional to
 * $$ \lambda \mapsto \lambda^{\alpha-1} e^{-\beta \lambda} \, $$
 * or it could mean the density is proportional to
 * $$ \lambda \mapsto \lambda^{\alpha-1} e^{-\lambda/\beta}. \, $$
 * This likelihood function would be proportional to
 * $$ \lambda \mapsto \lambda^x e^{-\lambda}. \, $$
 * Assuming the first alternative above, multiplying the likelihood by the prior density gives
 * $$ \lambda \mapsto \lambda^{x + \alpha - 1} e^{-(\beta + 1)\lambda}. \, $$
 * This is a Gamma density. &alpha; has been replaced by x + &alpha;, and &beta; by &beta; + 1. Michael Hardy (talk) 15:29, 16 October 2010 (UTC)
 * Thanks, that makes sense actually. But how do you do part ii of the question?---MrMahn (talk) 04:53, 17 October 2010 (UTC)

Series of bounded functions
Q: Let f1, ..., fn: $$\mathbb{R} \mapsto \mathbb{R}$$ be nounded functions and $$\delta,\,\epsilon > 0$$. Suppose f: $$\mathbb{R} \mapsto \mathbb{R}$$ is such that, whenever we have $$x,\, y,\, \in \mathbb{R}$$ with $$|f(x)-f(y)|>\delta$$, then $$|f_i(x)-f_i(y)|>\epsilon$$ for some i. Show that f is bounded.

A: At first glance this looks like fairly straightforward analysis, but I'm having problems with the fact that you don't get to fix the 'i' in the condition, so it seems hard to construct anything concrete which applies to just one i in particular, which I presume is what we need, and particularly when we're working over all the reals, so we can't guarantee in what sense the function f would be unbounded (if working towards a composition). I'm usually fairly comfortable when it comes to analysis so if someone could just point me the right way, I wouldn't need a complete answer, just a suggestion of a method to get started :) thanks very much!

Incidentally, this is a question on a Graph Theory worksheet, so if there's a graph theoretic solution then I'd prefer that! Thankyou. 62.3.246.201 (talk) 15:04, 16 October 2010 (UTC)


 * I don't believe the version you've written is true. Take f(x) = x, which is of course unbounded. Set f1 equal to a sawtooth wave with discontinuities at each integer, slope 1 elsewhere, minimum 0, maximum 1. Pick $$\delta = \epsilon = 1/3$$ (perhaps you meant for each $$\epsilon$$ there exists a $$\delta$$ satisfying your condition, or some variation on that theme, but it's not what's written). Any $$|f(x)-f(y)|>\delta$$ requires $$|x-y|>1/3$$. If both x and y happen to land on the same linear segment of f1, $$|f_1(x)-f_1(y)|>\epsilon = 1/3$$. Otherwise x and y can only land on adjacent linear segments. The leftmost, say x, must be in $$(n-1/3, n]$$ for some integer n, and the rightmost, y, must be in $$[n, n+1/3)$$. This forces $$2/3 < f(x) <= 1$$ and $$0 <= f(y) < 1/3$$, so they differ by at least 1/3rd. 67.158.43.41 (talk) 00:44, 17 October 2010 (UTC)


 * No, read the question again. Your example does not meet the assumptions. For example, for arbitary $$x$$, set $$y=x+1$$. Then $$|f(x)-f(y)|=1>\delta$$, but $$|f_1(x)-f_1(y)|=0\not>\epsilon$$. –Henning Makholm (talk) 01:03, 17 October 2010 (UTC)


 * Ah, of course. Yup, the above is garbage. 67.158.43.41 (talk) 01:55, 17 October 2010 (UTC)

First, since you have no assumptions of continuity, you can think of all functions as $$X\to\mathbb{R}$$ for some opaque set $$X$$. You should probably also scale your functions to make $$\epsilon=\delta=1$$ wlog, just to cut down on the number of symbols you need to keep in mind.

More specifically, is Ramsey's theorem in your syllabus? If so, label vertices with elements of $$X$$, and ponder which kind of edge relations your assumptions might allow you to consider ... –Henning Makholm (talk) 00:54, 17 October 2010 (UTC)


 * Yes, Ramsey theory has come up on one or two of the questions on this sheet already, but I hadn't thought of using it in the infinite dimensional case. I'll have a think and see if I can come up with anything of use then, thankyou everyone already for all your replies! Also I'm not aware of what an opaque set is, or at least I haven't heard the terminology before - is it just a subset of the reals satisfying some sort of measure/density related property, or something along those lines?62.3.246.201 (talk) 01:15, 17 October 2010 (UTC)


 * By "opaque" I just mean that you can forget it has any structure -- i.e. you cannot usefully exploit the fact that it's a field, or a total order, or a topological space. It is just a set with some elements. (I don't think it is standard terminology. Real mathematicians might probably just say "an arbitrary set"). –Henning Makholm (talk) 02:12, 17 October 2010 (UTC)
 * By the way, you're not really in an "infinite dimensional case". You work with finite graphs corresponding to some subset of the x's. Ramsey will tell you that you cannot keep adding vertices to the graph indefinitely, which allows you to bound the variation of f(x). –Henning Makholm (talk) 02:21, 17 October 2010 (UTC)

Improper Integral
How would I integrate e^(-x^2) dx from 0 to infinity? I tried using the chain rule but I get a plus/minus and I'm not sure what to do with that. Thanks, 24.92.78.167 (talk) 15:39, 16 October 2010 (UTC)


 * This function has no elementary anti-derivative, but you can calculate the value of the integral using a trick. Consider
 * $$ I := \int_{-\infty}^{\infty} \!\!\! e^{-x^2} \, \text{d}x = \int_{-\infty}^{\infty} \!\!\! e^{-y^2} \, \text{d}y \ . $$
 * We can multiply these together to give
 * $$ I^2 = \left(\int_{-\infty}^{\infty} \!\!\! e^{-x^2} \, \text{d}x\right)\left(\int_{-\infty}^{\infty} \!\!\! e^{-y^2} \, \text{d}y\right) = \int_{-\infty}^{\infty}\int_{-\infty}^{\infty} \!\!\! e^{-(x^2+y^2)} \, \text{d}x \, \text{d}y . $$
 * We can use polar coordinates to simplify this. Let x = r&thinsp;cos(θ) and y = r&thinsp;sin(θ), so that x2 + y2 = r2 and dx&thinsp;dy = r&thinsp;dr&thinsp;dθ. Thus
 * $$ I^2 = \int_0^{2\pi}\int_0^{\infty} \!\!\! re^{-r^2} \, \text{d}r \, \text{d}\theta = \pi \int_0^{\infty} \!\!\! 2re^{-r^2} \, \text{d}r = \pi \left[ -e^{-r^2} \right]_0^{\infty} = \pi . $$
 * Notice that your function is an even function, and so we have
 * $$ \int_{-\infty}^{\infty} = \int_{-\infty}^0 + \int_0^{\infty} = 2\int_0^{\infty} \, $$


 * $$ \int_0^{\infty} \!\!\! e^{-x^2} \, \text{d}x = \frac{1}{2}I = \frac{1}{2}\sqrt{\pi} \ . $$
 * The Erf function has been defined because of this problem. — Fly by Night  ( talk )  15:52, 16 October 2010 (UTC)


 * What formal proofs or definitions are needed to state that
 * $$ \left(\int_{-\infty}^{\infty} \!\!\! e^{-x^2} \, \text{d}x\right)\left(\int_{-\infty}^{\infty} \!\!\! e^{-y^2} \, \text{d}y\right) = \int_{-\infty}^{\infty}\int_{-\infty}^{\infty} \!\!\! e^{-(x^2+y^2)} \, \text{d}x \, \text{d}y $$ ?
 * I understand that
 * $$ \int_{-\infty}^{\infty} \!\!\! e^{-x^2} \, \text{d}x$$
 * is (assuming it converges) just a number, so
 * $$ \left(\int_{-\infty}^{\infty} \!\!\! e^{-x^2} \, \text{d}x\right)\left(\int_{-\infty}^{\infty} \!\!\! e^{-y^2} \, \text{d}y\right) = \int_{-\infty}^{\infty} \!\!\! \left(\int_{-\infty}^{\infty} \!\!\! e^{-x^2} \, \text{d}x\right) e^{-y^2} \, \text{d}y$$ ,
 * but how do I get from there to
 * $$\int_{-\infty}^{\infty}\int_{-\infty}^{\infty} \!\!\! e^{-x^2}e^{-y^2} \, \text{d}x \, \text{d}y $$ ?
 * I assume that it is because exp(y-2) is independent of x, but I worry about playing fast and loose with notation without understanding the justification. -- 124.157.218.5 (talk) 02:44, 17 October 2010 (UTC)


 * Yes (and it is good to worry about such things in general). First you consider the entire x integral to be "just a number" in order to move it inside the y integral. Then you consider just the integrand of the y integral. For any particular y, $$e^{-y^2}$$ is "just a number", so you can move it inside the x integral without changing the value of the y integrand for that y. The only formal prerequisite you need for that is that integration is linear, which is a basic requirement of integration.
 * The the polar coordinate transformation that follows is justified by the theory of multiple integrals, which is a bit more complicated than this. –Henning Makholm (talk) 03:14, 17 October 2010 (UTC)
 * Thank you. I see that my problem was really one of going from iterated integrals to multiple integrals, that is,
 * $$\int_{-\infty}^{\infty} \!\!\! \left(\int_{-\infty}^{\infty} \!\!\! e^{-(x^2+y^2)} \, \text{d}x\right) \, \text{d}y = \int_{-\infty}^{\infty}\int_{-\infty}^{\infty} \!\!\! e^{-(x^2+y^2)} \, \text{d}x \, \text{d}y$$
 * and is justified by Fubini's theorem. -- 124.157.218.5 (talk) 04:55, 17 October 2010 (UTC)
 * Exactly! Sorry I didn't give enough details to make everything clear. Thanks to Henning Makholm for clearing things up. — Fly by Night  ( talk )  15:07, 17 October 2010 (UTC)

We have an article about this very integral that gives at least two methods of finding it: Gaussian integral. Michael Hardy (talk) 03:11, 17 October 2010 (UTC)

Final coordinate
If I am given several (say 5) x,y coordinates and the ratio of matching radii from said points but NOT which ratio applies to which point and NOT an absolute distance. How would one work out a final coordinate of where 5 circles meet given that such a point exists? (Not homework, but part of me planning to set a puzzlle for a treasure hunt.) A theoretical or an empirical answer are both equally fine, but I would want to be able to get the final x & y to at least 6 sig figs. -- SGBailey (talk) 15:47, 16 October 2010 (UTC)


 * Are you going to allow the participants access to wp:rd/math to help them solve your puzzle? — Fly by Night  ( talk )  16:29, 16 October 2010 (UTC)
 * Yes - should they think to use it. :-) -- SGBailey (talk) 08:18, 17 October 2010 (UTC)


 * I can't think of an easy way to do this, but the following might help. The set of all points at distances from two points in a given ratio is a circle, and is relatively easy to construct: given the two points A and B draw the line through them and plot the points on it in the given ratio (one between the points, one outside), then draw the circle with centre on this line through the points. As it's easy to draw it's easy to calculate. If the ratio is 1:1 the circle is a straight line between the points. So given three points and the ratios of distances between them it should be possible to calculate three circles and so find the point.


 * But with you don't know which ratio to use with which point. The only way I can see is a search through all possible triplets of ratios, i.e. assign each to the three points in different ways and calculate the point, then calculate the distance to a fourth and see if its ratio matches an unused one. This could be very tedious for a large number of points, depending on the data: some datasets might be easier to work with than others. It might only be feasible using a computer.


 * Another way would be more statistical: pick points at random or in a grid, find the ratios of the distances to the coordinates, then compare them to the given ratios. Do it on a computer you should be able to quickly get a point close to the target so e.g. the sorted ratios match. which can then be refined to the required accuracy.-- JohnBlackburne wordsdeeds 21:51, 16 October 2010 (UTC)

connect the opposite sides of a square with lines that don't cross
These seems intuitively impossible to me as after you connect one set of opposite sides, you've blocked off one of the two remaining sides completely. Is the observation true? What is a rigorous proof that you cannot connect opposite sides of a square in two dimensions without the two connection lines crossing? This is not homework, I'm just curious. (I prefer an algabreic proof to a geometric one, since I never got how geometry proves anything, but if you just have a geometric proof it's ok). Thank you. 93.186.31.238 (talk) 20:48, 16 October 2010 (UTC)
 * It's only impossible if you require the lines doing the connecting to be completely straight. If you're assuming that, you haven't said so, and if you don't have that criterion, you can just connect one pair of sides with a line inside the square, and the other pair with a curving line (or a set of straight lines abruptly changing direction as needed) going around the outside.  Here, let me draw you some bad ASCII art:

____B____ ___/____    \    \__________/
 * ---A|      \
 * ________|     /
 * ---A|      \
 * ________|     /
 * ________|     /
 * A connects the vertical sides, B connects the horizontal sides, and they don't cross.--81.153.109.200 (talk) 21:04, 16 October 2010 (UTC)
 * (EC) I assume the "lines" can be curvy things, but must at all times stay inside the square? (If not, you can do it like this.) If they need to stay inside the square, think of the two lines as being the graphs of two continuous functions (say f and g) defined on the interval [0,1] with values in [0,1] so that f(0)=0 and f(1)=1 (this is the function that connects the lower-left to upper-right) and g(0)=1 and g(1)=0 (this is the other one). Now consider g(x)-f(x). This difference is 1 at x=0, and -1 at x=1. And right about now you should start feeling like the intermediate value theorem. Staecker (talk) 21:05, 16 October 2010 (UTC)
 * Your diagram is much prettier than mine! :D --81.153.109.200 (talk) 21:07, 16 October 2010 (UTC)
 * And now I see you asked about opposite sides rather than corners. You can do a similar argument in that case though. Staecker (talk) 21:08, 16 October 2010 (UTC)
 * That's a very restricted class of curves. For example, your curve from the left side to the right side moves only from left to right (and maybe up and down too) without ever wiggling back left. Can your approach be adapted to more general curves, or do we need the Jordan curve theorem for that case? Algebraist 21:16, 16 October 2010 (UTC)
 * You're right. I tried to avoid using the Jordan curve theorem, but now I think you'd have to. Staecker (talk) 15:42, 17 October 2010 (UTC)

OH DEAR
I MEANT ANY CURVY/SQUIGGLY "LINE" YOU WANT BUT I ALSO MEANT ALL ON THE OUTSIDE!!!!   Where I wrote: "after you connect one set of opposite sides, you've blocked off one of the two remaining sides completely."  I imagined: ____1____ ___/____    \    \__________/ Now what? (In this case the right side is the one you "blocked off".
 * ________|     /
 * ________|     /
 * ________|     /
 * ________|     /
 * ________|     /

Rereading my question this way, anyone have any proofs? Thank you and sorry about the confusion!!! 93.186.31.236 (talk) 22:57, 16 October 2010 (UTC)
 * Here's a proof using graph theory. Consider the graph in the picture.  If there were a way to connect vertices A and C, and vertices B and D on the outside of the square without crossing that would produce a plane graph of K5, but K5 isn't planar, so that's impossible.  Edit conflict apparently but I got no error message when I posted. Rckrone (talk) 01:53, 17 October 2010 (UTC)


 * That really just begs the question why the complete 5-graph is not planar. –Henning Makholm (talk) 02:02, 17 October 2010 (UTC)
 * Sure, but that's a well known result and it's not hard to track down a proof. For example the first hit on google  has one which uses the Euler characteristic of the plane.  If we're not allowed to refer to known theorems, then any non-trivial math result is going to take years of explaining. Rckrone (talk) 02:29, 17 October 2010 (UTC)
 * We are indeed not allowed to refer to known theorems when the proofs of those known theorems assume what we're trying to prove (or some very similar variant of it).
 * Just as an example, your Google hit simply asserts, early on: "If G is a planar graph, then any plane drawing of G divides the plane into regions, called faces. One of these faces is unbounded, and is called the infinite face." And it cannot even start talking about Euler characteristics without asserting this. The claim is intuitively obvious, but it is not more obvious than the property the OP wanted proved in the first place, and it represents exactly the kind of geometric intuition that he refers to as "never got how geometry proves anything".
 * If we want to prove, rather than just assert, the a plane drawing of a graph divides the plane into faces, we end up doing something extremely similar to the Jordan applications below. So appealing to graph theory here is not a shortcut but a detour. –Henning Makholm (talk) 02:57, 17 October 2010 (UTC)
 * I simply disagree that this square problem is somehow more fundamental than the Euler characteristic and the ideas in graph theory relating to planar graphs (although this is essentially subjective). For example, it's not hard to show from the Jordan curve theorem that a plane graph cuts the plane into separate regions if and only if contains a cycle.
 * Regardless, graph theory provides a toolbox that's well suited for this sort of problem. If the OP is interested in understanding how that toolbox is developed, then he/she has some direction for where to go from here, which would be to find a good intro treatment of the subject. Rckrone (talk) 03:34, 17 October 2010 (UTC)
 * In fact Jordan_curve_theorem even mentions a proof of the theorem based on the fact that K3,3 is not planar. That said, I don't myself know how one proves K3,3 is not planar without the Jordan curve theorem, but I guess it's either possible or that paper is junk. Rckrone (talk) 03:53, 17 October 2010 (UTC)


 * A rigorously written proof is, to be honest, very tedious in this case. As Algebraist mentioned, the Jordan curve theorem is the one you're looking for. Loosely, say you've connected the top and bottom edges of your square with a continuous curve C. Say the curve starts on the top edge at point T, ends on the bottom edge at point B, doesn't intersect itself, and doesn't intersect the square anywhere else. There are two ways to connect T and B traveling only on the square--left from T, follow the left edge, right until you hit B; or right from T, follow the right edge, left until you hit B. Call the curves thus generated C1 and C2. Now combining C1 with C satisfies the requirements of the Jordan Curve Theorem and generates two connected components, E1 and E2, with C1+C as the boundary between them. The right edge (except perhaps a corner) didn't take part in the curve C1+C, so doesn't intersect the boundary C1+C, so is entirely within one of the connected components E1 or E2. If the right edge is within the interior (explained on the linked page), great. Any line starting in the exterior must cross the boundary C1+C to get to the interior, so restricting such a line to not cross any existing lines (the square and C) prevents that line from touching the right edge. If the right edge is within the exterior, the inside of the square + the right edge (except the corners) does not cross C1+C by assumption, so is entirely within E1 or E2--so, apparently, entirely within the exterior. Union the interior, the interior of the square, and C1 except T and B to create a new connected component. Since this component is bounded, and has boundary C2+C, the left edge, which is in this component, is in the interior of C2+C. This can be made a bit more rigorous, particularly the final union step, showing the union preserves connected component-ness and has the given boundary; but, this outline could certainly be turned into a rigorous (algebraic) proof if one had the patience. 67.158.43.41 (talk) 01:49, 17 October 2010 (UTC)

(Edit conflict .. the following is essentially "what he said" with slightly different details):
 * Inside or outside is actually more or less the same thing in this case; a solution to the outside problem turns into one of the inside one (and vice versa) by a circle inversion centered on your square followed by some additional stretching and squishing to make the distorted square look like a square again.
 * Your intuition is right; one cannot connect both pairs of sides without intersections.
 * Proof. Connect the top and bottom sides on the outside in whichever way you please except without the line crossing itself. Then add a straight line right down the middle of the square. Together with parts of the top and bottom, this completes a closed curve which we now apply the Jordan curve theorem to. This is the crucial step! The theorem tells us:
 * Every point not on the curve is either inside the curve or outside the curve.
 * These two component are connected components, which means (among other things) that there is no continuous path that contains both an inside point and an outside point, but does not cross your closed curve.
 * The closed curve constitutes the boundary of the inside, and also the boundary of the outside. That means (among other things) that any point on the curve will be next to a part of the inside and next to part of the outside.
 * The point in the middle of the square sits on the closed curve, and the third property now says that somewhere in the square is a point A that is outside the curve, and somewhere in the square is a point B that is inside the curve. These two points cannot both be in the right half of the square, for then the straight line that connects them would violate the second property. For the same reason they cannot both be to the left of the straight line. Assume that A is to the left and B is to the right. (Otherwise just swap "left" and "right" below).
 * Now assume (for contradiction) that you could connect the left and right side outwith the square without touching the wiggly top-bottom connection. Then the left-right connection could be extended from its left endpoint to A and from its right endpoint to B, again without touching the closed curve. This gives us a continuous path from A to B that does not cross the closed curve. But that is forbidden by the second property! Therefore our assumption must be false. We cannot connect the left to the right. Q.E.D.
 * You may consider this presentation more "geometric" than "algebraic", but except for the Jordan theorem, all of the tricky details happen inside the square, where they are easily formalized with coordinates and inequalities instead of appeals to geometric intuition. –Henning Makholm (talk) 01:51, 17 October 2010 (UTC)