How can $(\sqrt n)^2$ for $n$ not a perfect square be an integer?

For any positive integer $n$, $\sqrt{n^2}=n$. This looks pretty obvious, but if the nature of an irrational number is considered it doesn't look that obvious.

I mean, $\sqrt n$ where $n$ is not a perfect square will be irrational and have an infinite decimal expansion. But consider $$17=17.00000000\dots$$ No number from 0 to 9 will give 0 as the result. That looks like it makes impossible an irrational number squaring to a positive integer, as the only way to get a 0 in all decimal places would be to have all digits on the supposed irrational number 0.

I'm not a maths person, so I may have committed lots of errors, but it doesn't look like there's any big one, understanding it in the level that a non-maths person should have. What's the failure in my reasoning?

• I don't know if I really got your point, but the truth lies in the definition itself of the square root squared: given a positive real number $N$: $$\sqrt{N^2} = N$$ and $$\sqrt{N}\cdot \sqrt{N} = \sqrt{N^2} = N$$ No matter if $N = 7$, $N = \sqrt{3}$ or whatever. – Von Neumann Sep 24 '16 at 13:30
• I know it, but if you calculate the irrational number, considering that some way it would be possible to "have" its infinite digits, there's no way you could multiply it by itself and it would give an exact positive integer number, so I guess the answer has to do with the fact that digits are infinite. – user2638180 Sep 24 '16 at 13:33
• What about $3\cdot \frac 13=1$? – Hagen von Eitzen Sep 24 '16 at 13:37
• I know about the 0.99999...=1 equality, but this doesn't look the same. – user2638180 Sep 24 '16 at 13:44
• @user2638180: Decimals carry; note that $0.33^{2} \neq 0.99$. For instance, $1.4142^2 = 1.99996164$ exactly. – Andrew D. Hwang Sep 24 '16 at 14:23

The usual algorithm for multiplication doesn't really work with irrationals. You're supposed to start multiply digits starting with the right-most one, but it just isn't there.

That looks like it makes impossible an irrational number squaring to a positive integer, as the only way to get a 0 in all decimal places would be to have all digits on the supposed irrational number 0.

This assertion is not proved: you just feel like it should be so. But it's false.

Actually, suppose we define real numbers as infinite decimal expansion, possible ending in an infinite sequence of $0$s (these are decimal numbers) or an an infinite sequence of a repeating pattern, like $1.2\color{red}{12487}12487\dots$ (these are rational numbers).

To define the product of two real numbers from this definition, we would truncate both numbers to a finite number of decimals, compute the product of theses truncated numbers with the ordinary method for decimal numbers that is learnt in elementary school. The we would show that, as we use more and more decimals, more and more decimals in the product stabilise. So we would define the product of two real numbers as the number with decimals that are these stabilised decimals.

Given this (not very effective) definition of the product of two real numbers, there is no particular reason why the product of two irrational numbers might not be an integer, i.e. a real number with all decimals equal to $0$ from the first one.

You are confusing the 'behavior' of numbers in the abstract, under the various abstract operations, with the 'behavior' of representations of numbers under representations/implementations of those operations in terms of those representations of numbers. The purely abstract definition of the square-root operator is '$y = \sqrt(x)$ IFF $y^2 = x$', so there is no surprise finding that $(\sqrt(x))^2 = x$.

Whether this translates to decimal expansion is a question about whether the representation truly represents. And as for that, others have already mentioned the '.9999...' counterpoint. To see this for yourself, perform the following experiment: Write down the decimal expansion of $\sqrt(2)$ truncated to 1, 2, ..., k digits (for whatever value of k you can tolerate). Take each truncated expansion in order of increasing number of digits and square it by hand on paper, so you can see all of the digits (using a calculator here would obscure things). What you should see is that each successive squared value will have a fraction with an increasingly long run of 9's as prefix. The behavior in the limit should now be clear.

• It would be an improvement to your "abstract" definition of $y = \sqrt{x}$ to restrict it to non-negative real numbers $x$ as the domain. – hardmath Sep 24 '16 at 15:14

Giving an honest answer to the question requires explaining in detail what an infinite decimal means, which entails concepts (greatest lower bounds, completeness of the real number system, infinite series) not usually encountered until university-level math.

In an attempt to be as honest as possible without too much technical overhead: As noted in my comment, $$1.4142^{2} = 1.99996164.$$ Generally, the square of a finite decimal $x_{n}$ can be equal to an arbitrary integer followed by a decimal point, an arbitrarily long string of $9$'s, and some trailing finite string of digits.

It turns out that if $N$ is not a perfect square, there is exactly one infinite decimal expression $x$ with the property that truncating $x$ after $n$ decimals and squaring the resulting number $x_{n}$ yields $(N - 1)$ followed by a decimal point, a string of $9$'s that can be as long as you like (by taking $n$ sufficiently large), followed by some trailing finite string of digits.

The way multiplication of infinite deciamls is defined, $$x^{2} = (N - 1).9\overline{9} = N.$$