Extending a function T from a subspace X of a Hilbert space H to H $\phi:N to N$, $H$ is Hilbert space with O.N.B $\{e-i\}-i=1 to \infty$and $X=span\{e-1,e-2,...\}$ and $T:X to H$ so that $ T(e-i)=e-\phi(i)$. Now we want to characterize (by finding necessary and sufficient conditions on $\phi$) when $T$ extends to a bounded linear $S:H--->H$ and determine $S^*$.
 A: The operator $T:X\to H$ is bounded if and only if there exists $k\in\mathbb{N}$ so that all the sets $\{i\in\mathbb{N}:\phi(i)=\phi(j)\}$ have at most $k$ elements for all $j\in\mathbb{N}$. In this case, $T$ extends (uniquely) to a continuous operator $S:H\to H$ (since $X$ is dense in $H$). The adjoint of $S$ is the unique continuous, linear operator that maps $e_j$ to $0$ if $j\not\in\varphi(\mathbb{N})$ and maps $e_j$ to $\sum_{i\in\phi^{-1}(j)}e_i$ if $j\in\varphi(\mathbb{N})$.
Let's prove this. We will need the following elementary lemma:

Lemma: Let $m\in\mathbb{N}$ and $t_1,\dots, t_m\in\mathbb{C}$. Then
$$\bigg(\sum_{j=1}^m|t_j|\bigg)^2\leq(m+1)\sum_{j=1}^m|t_j|^2.$$

Proof: by the identity for the square of a sum we have that
$$\bigg(\sum_{j=1}^m|t_j|\bigg)^2=\sum_{j=1}^m|t_j|^2+2\sum_{i=1}^m\sum_{j\neq i}|t_i||t_j|$$
Now if $i\neq j$ then $2|t_i||t_j|\leq|t_i|^2+|t_j|^2$. Therefore
$$2\sum_{i=1}^m\sum_{j\neq i}|t_i||t_j|\leq\sum_{i=1}^m\sum_{j\neq i}(|t_i|^2+|t_j|^2)=\sum_{i=1}^m\bigg(\sum_{k=1}^m|t_k|^2\bigg)=m\sum_{k=1}^m|t_k|^2 $$
So
$$\bigg(\sum_{j=1}^m|t_j|\bigg)^2\leq(m+1)\sum_{j=1}^m|t_j|^2$$
q.e.d.
Now let's get to our proof. First assume that there exists $k\in\mathbb{N}$ so that $\phi^{-1}(\{\phi(j)\})$ contains at most $k$ elements for all $j\in\mathbb{N}$. Then if $x\in X$, say $x=\sum_jx_je_j$ where only finitely many of the $x_j$ are non-zero numbers, then
$$\|Tx\|^2=\bigg\|\sum_jx_je_{\phi(j)}\bigg\|^2=\sum_{j\in\mathbb{N}}\bigg|\sum_{i: \phi(i)=\phi(j)}x_i\bigg|^2\leq\sum_{j}\bigg(\sum_{i:\phi(i)=\phi(j)}|x_i|\bigg)^2\leq$$
$$\leq\sum_j\bigg((k+1)\sum_{i:\phi(i)=\phi(j)}|x_i|^2\bigg)=$$
$$=(k+1)\sum_j|x_j|^2=(k+1)\|x\|^2$$
explanations: first inequality: triangle inequality, second inequality: we used the lemma. second equality: this follows from Parseval's identity (just think about it). second last equality: this follows from the fact that the sets $S_j:=\{i\in\mathbb{N}: \phi(i)=\phi(j)\}$ are a partition of $\mathbb{N}$.
So $T$ is bounded and $\|T\|\leq\sqrt{k+1}$.
Conversely, assume that this is not true, so for any integer $k\in\mathbb{N}$ there exists $n\in\mathbb{N}$ and $k+1$ integers, namely $i_1,\dots, i_{k+1}\in\mathbb{N}$ so that $\phi(i_1)=\phi(i_2)=\dots=\phi(i_{k+1})=n$. Assume (to reach a contradiction) that $T$ is bounded, so there exists $C>0$ so that $\|Tx\|\leq C\|x\|$ for all $x\in X$.
Find an integer $N\in\mathbb{N}$ so that $N>C^2$. For that integer $N$, find $s\in\mathbb{N}$ and $N+1$ integers $i_1,\dots,i_{N+1}$ so that $\phi(i_j)=s$ for all $j=1,\dots, N+1$. Then, for all real, positive numbers $t_1,\dots,t_{N+1}>0$ we have that
$$T\bigg(\sum_{j=1}^{N+1}t_je_{i_j}\bigg)=\bigg(\sum_{j=1}^{N+1}t_j\bigg)e_s$$
so, taking norms squared and using the assumption (which is true for all $x\in X$), we get
$$\bigg(\sum_{j=1}^{N+1}t_j\bigg)^2\leq C^2\cdot\sum_{j=1}^{N+1}t_j^2\leq N\cdot\sum_{j=1}^{N+1}t_j^2 $$
This is a contradiction: take $t_1=\dots=t_{N+1}=1$. the above inequality then becomes
$$(N+1)^2\leq N\cdot(N+1)$$
which is false.
I leave the computation of the adjoint to you, it is not hard from this point onwards.
