A continuous function on a compact set is bounded and attains a maximum and minimum: "complex version" of the extreme value theorem?

My textbook, Complex Analysis, by Shakarchi and Stein, gives the following theorem:

Theorem 2.1 A continuous function on a compact set $$\Omega$$ is bounded and attains a maximum and minimum on $$\Omega$$.

This is of course analogous to the situation of functions of a real variable, and we shall not repeat the simple proof here.

I was trying to find the real and complex proofs for this, but I'm not completely sure what the theorem is.

I thought it looked similar to the extreme value theorem:

If a real-valued function $$f$$ is continuous on the closed interval $$[a,b]$$, then $$f$$ must attain a maximum and a minimum, each at least once.

The Wikipedia article for compact spaces describes them as follows:

In mathematics, more specifically in general topology, compactness is a property that generalizes the notion of a subset of Euclidean space being closed (i.e., containing all its limit points) and bounded (i.e., having all its points lie within some fixed distance of each other).

EDIT: As can be seen in the comments, there is some confusion as to whether what I had originally written here makes sense. Under the impression that what I had originally written was incoherent, I made an edit that rewrote this section in such a way that I thought might make more sense. However, based on MoonLightSyzygy's comment, it seems that what I had originally written might have been fine. So what I'm going to do is include both versions of this section, so that someone may give a more definitive answer as to which is (the most) coherent. As you can see, I am a novice in the area of mathematical analysis, so I apologise for any confusion.

Version 1:

Given this definition of compactness, it seems to me that such a real-valued function is indeed compact. My understanding is that real-valued functions are indeed subsets of Euclidean space (it is my understanding that they are subsets of $$\mathbb{R}^n$$). Furthermore, since the real-valued function $$f$$ is continuous on the closed interval $$[a, b]$$, it is by definition both closed and bounded. Therefore, such a real-values function satisfies all of the conditions necessary for compactness.

Version 2:

Given this definition of compactness, it seems to me that the domain of such a real-valued function is indeed compact (if I'm understanding this correctly, the requirement is that the domain of the function be compact, right?). My understanding is that the domains of such real-valued functions are indeed subsets of Euclidean space (it is my understanding that the domains of real-valued functions are subsets of $$\mathbb{R}^n$$). Furthermore, since the real-valued function $$f$$ is continuous on the closed interval $$[a,b]$$, it is by definition both closed and bounded. Therefore, such a real-values function satisfies all of the conditions necessary for compactness.

Is what I've written here correct? Am I misunderstanding anything?

Is the textbook's theorem the "complex version" of the extreme value theorem? If not, then what are the theorems in question that I am seeking?

And as an aside, is it the case that all real-valued functions are compact? It seems to me that this is clearly not the case, but I would just like to confirm.

I would greatly appreciate it if people would please take the time to clarify this.

• What do you mean by "a real-valued function is a subset of $\mathbb{R}^n$"?
– Nick
Commented Dec 31, 2019 at 14:31
• @Nick Sorry, you're right, that doesn't make sense. I will make an edit. Commented Dec 31, 2019 at 14:32
• @Nick So, my understanding is that to say that a function is "on a set" means that the set in question is the domain of the function, correct? That's what I'm attempting to describe. Commented Dec 31, 2019 at 14:39
• Functions are sets of pairs. So, saying that a real function $f:\mathbb{R}^{n-1}\to\mathbb{R}$ is a subset of $\mathbb{R}^n$ makes perfect sense, by viewing elements of $\mathbb{R}^{n-1}\times \mathbb{R}$ as elements of $\mathbb{R}^n$. Commented Dec 31, 2019 at 15:08
• @MoonLightSyzygy Are you saying that the description I made in my post is coherent? Or are you saying the contrary? Commented Dec 31, 2019 at 15:10

A complex number can be written as $$z=x+iy$$ and a complex function with complex output is given by $$f(z)=u(x,y)+iv(x,y),$$ where $$u:\mathbb{R}^2\to\mathbb{R}$$, $$v:\mathbb{R}^2\to\mathbb{R}$$. Note that if $$v(x,y)=0$$ for all $$(x,y),$$ then $$f$$ is just real-valued.
The magnitude (or modulus) is given by $$|f(z)|=\sqrt{[u(x,y)]^2 + [v(x,y)]^2},$$ which is a real number. Show that the function $$(x,y)\mapsto\sqrt{[u(x,y)]^2 + [v(x,y)]^2}$$ is continuous, which is true since $$f$$ is continuous.
If all $$(x,y)\in K,$$ where $$K$$ is a compact subset of $$\mathbb{R}^2$$, then you can just apply the extreme value theorem from $$\mathbb{R}^2\to\mathbb{R}.$$ Somewhere in $$K$$, $$|f(z)|$$ has maximum modulus.