# If $\{f_n\}$ converges uniformly on $(a,b)$, $\{f_{n}(a)\}$ and $\{f_{n}(b)\}$ converge pointwise, then it converges uniformly on $[a,b]$

Prove that if $\{f_n\}$ converges uniformly on $(a,b)$, $\{f_{n}(a)\}$ and $\{f_{n}(b)\}$ converge pointwise. I want to show that $\{f_n\}$ converges uniformly on $[a,b]$

MY TRIAL:

Let $\epsilon>0$, since $\{f_n\}$ converges uniformly on $(a,b)$, then $\exists\,N_1=N(\epsilon)$ s.t. $\forall \,n\geq N$, $\forall x\in (a,b)$ \begin{align}\left|f_n(x)-f(x)\right|<\epsilon\end{align}

Since $\{f_n\}$ converges pointwise when $x=a$, then $\exists\,N_2=N(\epsilon,a)$ s.t. $\forall \,n\geq N$,
\begin{align}\left|f_n(a)-f(a)\right|<\epsilon\end{align}

Also, $\{f_n\}$ converges pointwise when $x=b$, then $\exists\,N_3=N(\epsilon,b)$ s.t. $\forall \,n\geq N$,
\begin{align}\left|f_n(b)-f(b)\right|<\epsilon\end{align}

Hence, $\forall \,n\geq \max\{N_1,N_2,N_3\},$

$$\lim\limits_{n\to \infty}f_n(x)=\begin{cases}f(a) & x=a,\\f(x)&x\in(a,b),\\f(b)&x=b\end{cases}$$ Hence, $\{f_n\}$ converges uniformly on $[a,b]$.

Please, I'm I right? If no, an alternative proof will be highly regarded. Thanks!

Your proof is correct! In general you can prove that if a sequence of functions $\{f_n\}_n$ converges uniformly on a finite set of domains $A_1,\dots,A_k$ (in your case the domains are $A_1=\{a\},A_2=(a,b),A_3=\{b\}$), then it converges uniformly in its union $\cup_k A_k.$
Indeed, for every $\epsilon>0$ there exist $N_1,\dots,N_k$ such that for every $n\geq N_i$ it is true that $|f(x)-f_n(x)|<\epsilon$ for every $x\in A_i$.
It is then sufficient to consider $N=max \{N_1,\dots,N_k\}$ to say that $|f(x)-f_n(x)|<\epsilon$ for every $x\in \cup_i A_i$ and for every $n\geq N,$ which is exactly the concept of uniform convergence.