How can $f(x) = x^2$ be continuous?

I know $$f(x) = x^2$$ is continuous because it is defined in every point. My question is related to an idea I had. I am curious if formal mathematics has approached this same concept in a formal way. My idea is as follows

If we evaluate $$f(x)=x^2$$ from $$x=1$$ to $$x=2$$, then the domain is $$[1 and the range is $$[1. If it is continuous, then we can choose any point $$y'$$ in the range $$1$$ to $$4$$, and find a value $$x'$$ that satisfies the relation $$y'=(x')^2$$ and where $$x$$ has a value between $$1$$ and $$2$$. The same applies the other way: if we choose any value $$x''$$ between $$1$$ and $$2$$, we can find a value $$y''$$ that is located between $$1$$ and $$4$$, and that satisfies the relation $$y''=(x'')^2$$. Since both, $$x''$$ and $$y'$$ were arbitrary, that means that the set of values from $$1$$ to $$2$$ (the domain) has the same size as the set of values from $$1$$ to $$4$$ (the range), but that is not possible. I know there are infinite values between two given numbers, and that comparing infinities is often a problem. However, I am interested in how can $$x^2$$ be continuous if basic logic says that the infinite range is bigger than the domain.

I am starting with mathematical analysis, so my logic is probably wrong, but if so, I would like to know what I am missing.

Also, English is not my first language. I apologize in advance if I am not using the proper terms.

EDIT: I was focused on my idea and I gave a wrong definition of continuity. The function must not abruptly change in value as well.

• Comments are not for extended discussion; this conversation has been moved to chat. Nov 9, 2021 at 15:15
• You might find it useful to research Hilbert's Hotel. This is an amusing way to investigate the oddness of infinite sized sets. How some sets are the same "size" even though intuitively one is bigger. This previous question might help: math.stackexchange.com/questions/3557700/…. Nov 9, 2021 at 15:35

You're mixing up a lot of concepts there, and that's part of what's confusing you. To give you some direction on things:

The size of sets

For finite sets, it's easy to say that their size is the number of elements in them. So $$|\{1, 5, 7\}| = 3$$ and so on. But with infinite sets, that becomes problematic. The generalised version of this is the cardinality of a set, and we say that sets have the same cardinality if you can create a perfect map of elements between them. So $$\{1, 5, 7\}$$ and $$\{a, b, c\}$$ have the same cardinality because we can pair up $$(1, a), (5, b), (7, c)$$ (or other arrangements). With infinite sets, it turns out that some things that look bigger or smaller than each other are actually the same cardinality (for example, the set of rational numbers - fractions of whole numbers - is the same cardinality as the set of natural numbers) while others are provably different sizes (for example, the set of real numbers between 0 and 1 is larger than the set of integers).

In the sense of cardinality, then, the interval $$[1, 2]$$ has the same number of points as $$[1, 4]$$ - the mapping $$y = x^2$$ is a perfect bijection from $$[1, 2]$$ to $$[1, 4]$$, meaning that every point in the domain has exactly one point in the range that it pairs with.

There is a different concept - that of measure - that gives a way to say that the interval $$[1, 4]$$ is three times the size as $$[1, 2]$$, but for this kind of discussion it's less relevant.

Continuity

Usually in school, continuity is introduced as the idea that "you can draw the graph of the function without lifting your pen from the paper" - i.e. the function has a curve that is completely connected. This gets formalised with discussion of limits - a function has a limit at a point if you can get arbitrarily close to the limit value by getting arbitrarily close to the point, and a function is continuous at the point if that limit is equal to the function's value at the point.

Later on, this gets further generalised by talking about things called topologies, and open sets, but again that's a step too far (and funnily enough happens to involve some interaction with measure theory too).

Infinity is weird

You're going to find, especially if you're self studying, that some things behave unintuitively, and this mostly boils down to the fact that some things that "obviously" work in a certain way only work like that under very special conditions, but those conditions are the ones you're most familiar with. Something can be true for every finite value (e.g. "adding one element to a set with $$n$$ elements gives you a set of $$n+1$$ elements, which is larger"), but if you blindly try to apply it to "infinity" it breaks (the set $$\{0, 1, 2, \ldots\}$$ has just as many elements as $$\{1, 2, \ldots\}$$).

Sad to say, it only gets worse - most functions aren't continuous, most numbers aren't rational, you can change the size of something without stretching or shrinking it, and you can prove that there are true facts that can't be proven. Most of these things involve messing around with infinities so that the intuitive part is relegated to a small subset of the bigger, unintuitive whole, and lots of mathematics is about (a) finding new intuitions to deal with them, and (b) being incredibly careful about defining what you can and can't do so that you don't wind up breaking something else.

Here is your issue, as you have already identified yourself: "I know there are infinite values between two given numbers, and that compare infinites is often a problem."

The sets $$(1,2)$$ and $$(1,4)$$ do have the same 'size' ('cardinality' is the appropriate term in this context) despite the fact that one is properly contained in the other. Funny enough, to establish the fact that they have the same cardinality, you only need to find a bijection between the two sets and $$x \mapsto x^2$$ does the job (as does $$x \mapsto 3x-2$$).