Pointwise convergence of a sequence of piecewise functions $\{f_n\}$
For $n \ge 1$, define functions $f_n$ on $[0,\infty)$ by
$$f_n (x) = \begin{cases} e^{-x} &\quad\text{for}\quad 0 \le x \le n\\ e^{-2n} (e^n + n - x) &\quad\text{for}\quad n \le x \le n + e^n \\ 0 &\quad\text{for}\quad x\ge n + e^n. \end{cases} $$
The answerer for the post that I linked above said that $f_n$ converges pointwise to $e^{-x}$ for all $x \in [0, \infty)$.
However, for $x\in [n,e^n+n]$ doesn't it go to $0$? And also for $x \in [e^n+n, \infty)$ it also goes to $0$ because $f_n(x)=0$ for $x$ in that interval. Why does the answer say that it converges to $e^{-x}$ for all $x\in[0,\infty)$? Isn't it only for $x\in[0,n]$ that it converges to $e^{-x}$?
How does one prove that for $x\in [n,n+e^n]$ that $f_n \to e^{-x}$? Because clearly to me $f_n$ converges to $0$ not $e^{-x}$.
If I just ignore all the logic behind it and try to prove that $f_n \to e^{-x}$ pointwise I get this (Im not sure if this is even correct)
Proof: Let $\epsilon >0$ and $x\in[0,\infty)$ be fixed but arbitrary. Take $N>x$.
Then because $n\geq N>x$ we have that $n\geq x$ which means that
$|f_n(x)-e^{-x}|=|e^{-x}-e^{-x}|=0<\epsilon$ and $f_n(x)=e^{-x}$ because we took $N>x$.
I will explain you the argument they have used for proving the pointwise convergence here: Pointwise convergence of a sequence of piecewise functions $\{f_n\}$
First, let us understand what "point-wise" convergence means. If we are given a sequence of (real - valued) functions $\left\lbrace f_n \right\rbrace$, each of which is defined over the same domain, say $D$, then for every point $x \in D$, we get a sequence of real numbers $\left\lbrace f_n \left( x \right) \right\rbrace$. Suppose that this sequence converges for every $x \in D$, say to $l_x$. Here, I use $l_x$ to denote that the limit depends on the choice of $x$.
Then, we can define a function $f: D \rightarrow \mathbb{R}$ as $f \left( x \right) = l_x$. We then say that the sequence of functions $\left\lbrace f_n \right\rbrace$ converges "point-wise" to the function $f$, and consequently, $f$ is called the point-wise limit of $\left\lbrace f_n \right\rbrace$.
Now, coming to your question, we first see what the sequence of functions is defined as
$$f_n \left( x \right) = \begin{cases} e^{-x} & 0 \leq x \leq n \\ e^{-2n} \left( e^n + n - x \right) & n \leq x \leq n + e^n \\ 0 & x \geq n + e^n \end{cases}$$
First, we observe that the sequence of functions is defined on $\left[ 0, \infty \right)$. Next, we see for each $x \in \left[ 0, \infty \right)$, what is the corresponding sequence of real numbers $\left\lbrace f_n \left( x \right) \right\rbrace$.
For that, we shall make use of the Archemedian property: https://www.math.upenn.edu/~kazdan/508F14/Notes/archimedean.pdf
In our terms, it says that $\forall x, y \in \mathbb{R}$ with $x > 0$, $\exists n \in \mathbb{N}$ such that $nx > y$.
Now, for our case, we have $x \geq 0$. Then, by Archemedean property, $\exists n_0 \in \mathbb{N}$ such that $n > x$, or in other words $x \in \left[ 0, n_0 \right]$. In fact, $\forall n \geq n_0$, $x \in \left[ 0, n \right]$. Therefore, the sequence $\left\lbrace f_n \left( x \right) \right\rbrace$ is an eventually constant sequence which takes the value $e^{-x}$, which is defined as the "point-wise" limit of $\left\lbrace f_n \right\rbrace$.
I hope this clears up everything.