Tietze's Extension Theorem: Suppose $X$ is a metric space and $S$ is a closed subset of $X$. Suppose $f \in C(S,\mathbb R)$, where $C(S,\mathbb R)$ refers to the space of bounded continuous functions from $S \rightarrow \mathbb R$. Then $~\exists ~\bar f \in C(X, \mathbb R)$ such that $\bar f_{|S} = f, \inf \bar f(X) = \inf f(S), \sup \bar f(X) = \sup f(S)$.
Lemma used in the proof :~ Suppose $X$ is a metric space and $S$ is a closed subset of $X$. Suppose $f \in C(S,\mathbb R)$ is not constant. Let $a = \inf f(S), ~b= \sup f(S) , ~k = \dfrac {b-a}{3}$ Then, there exists a function $f^+$ that has the properties : $f^+(X) \subseteqq [a+k,b-k], \inf (f-f^+)(S) = -k,~ \sup (f-f^+)(S)=k$
Proof: If $F$ is constant, the result is trivial. So, we suppose otherwise.
Define $h_1 = f^+$.
Step $1$: Given that $f : S \rightarrow [a,b]$ is a continuous function. Then : we know that $\sup (f-f^+)(S) = k , \inf ( f - f^+)(S) = -k$
$\therefore f - h_1 = f - f^+$ is a function from $S \rightarrow [-k,k]$ and $f-f^+ \in C(S,\mathbb R)$.
Step $2$ : Applying the same process to the function $f - f^+ = f - h_1$, we get :
$a' = -k, ~b' = k, k'=\dfrac {2k}{3}$ w.r.t $[-k,k]$
$h_2 = (f-h_1)^+$
By using the relations mentioned in the lemma: We get : $\inf (f-h_1-h_2)= -\dfrac{2k}{3}, \sup (f-h_1-h_2)= \dfrac {2k}{3}. $
$\therefore f-h_1-h_2 :S \rightarrow [-\dfrac {2k}{3}, \dfrac {2k}{3} ]$
$\therefore k'' = \dfrac {4k}{3 \cdot 3} = \dfrac {4k}{9}$
Applying step $1$ again, let $h_3 = (f-h_1-h_2)^+$
In the same way, we obtain a sequence $(h_n)$ with the property that $h_n= (f-h_1-h_2 - \cdots h_{n-1})^+$ and : $\inf (f-h_1-h_2 - \cdots h_n)= -\dfrac {2^{n-1}k}{3^{n-1}}, \sup (f-h_1-h_2 - \cdots h_n) = \dfrac {2^{n-1}k}{3^{n-1}}$
and $h_n \in [-\dfrac {2^{n-1}k}{3^{n}}, \dfrac {2^{n-1}k}{3^{n}}]$
Step $3$: Let $s_n= h_1+ \cdots h_n$.
Then $(s_n)$ is a cauchy sequence in $C(X,\mathbb R)$ since $|s_m-s_n| \le |h_1| + \cdots |h_n| \le (2/3)^n k$
Since $C(X,\mathbb R)$ is complete $(s_n)$ converges to some $\bar f \in C(X,\mathbb R)$
Step $4$ : Now, we claim that $\bar f$ is a desired extension of $f$. It is in this step where I am encountering problem understanding.
Since, $|f - h_1 - \cdots - h_n| \le (2/3)^n k \implies s_n \rightarrow \bar f$ uniformily on $A$
BUT, $|s_n| \le |h_1| + \cdots + |h_n| \le \dfrac {k}{3} ( 1 + \dfrac {2}{3} + {(\dfrac {2}{3}})^2 + \cdots )= k \implies \bar f_{|S} \in [-k,k]$. But, the range of $\bar f$ on $A$ should be $[a,b]$ which means $\bar f$ is clearly not the desired extension.
Please help me understanding where I could be wrong?. Thanks a lot for reading through!
I'm not sure where do you take your last equation from. While it is true that $\|f-h_1\|=k$, the range of $h_1$ is inside $[a+k,b-k]$ and $\|h_1\|=\max\{|a+k|,|b+k|\}$.
By the Lemma the range of $h_2$ is inside $[-k+k',k-k']=[-k/3,k/3]$. Hence the range of $h_1+h_2$ lies inside $[a+k-k/3,b-k+k/3]=[a+(2/3)k,b-(2/3)k]$.
Then for every $n$ from the fact that the range of $h_n$ (for $n$ greater than $1$!!!) is inside $[-2^{n-1}k/3^n, 2^{n-1}k/3^n]$ you may derive that the range of $h_1+\cdots+h_n$ lies inside $[a+k-k/3-\cdots-2^{n-1}k/3^n, b-k+k/3+\cdots+2^{n-1}k/3^n]=[a+(2/3)^n k, b-(2/3)^n k]$.