I consider the set $X=\{x_1,x_2,x_3\}$ and add the indiscrete topology on $X$. Now I take $Y=[1,3]$ in $R$, with usual topology.We define a mapping $f:X$$\longrightarrow$ $Y$ defined by $f(x_i)=x_i ,$ for $i=1,2,3$ as we see $Y$ is $T_2$; $\{1\}$ is closed in $Y$. It's inverse image is not closed in $X$. So $f$ is not continuous . $Y$ is compact $T_2$ space and $f(X)=\{x_1,x_2,x_3\};$ closed in $Y$. $X$ is obviously closed so the graph of $f$ i.e. $X\times f(X)$ is closed , which contradicting to the statement of Closed Graph Theorem; says that $f$ needs to be continuous. where am I assuming wrong?Thanks for reading!
The closed graph theorem says that let $f:X\longrightarrow$$Y$; $Y$ is compact $T_2$ then $f$ is continuous if and only if the GRAPH of $f,G_f=\{x*f(x)\}$ is closed in $X*Y$.
The graph of $f$ is the set $\Gamma(f) = \{(x,f(x)): x \in X\}\subseteq X \times Y$ for any function $f:X \to Y$.
In this case it's the set $\{(x_1,1), (x_2,2), (x_3, 3)\}$ which is not closed in $X \times Y$: e.g. the point $(x_1,3)$ is in the closure of the graph: let $O$ be any open set in $ X \times Y$ that contains $(x_1,3)$, then there is a box $O_1 \times O_2$ with
$$(x_1,3) \in O_1 \times O_2 \subseteq O$$ where $x_1 \in O_1$ and $O_1 \subseteq X$ open, and $3 \in O_2$, $O_2 \subseteq Y$ open. As $X$ is indiscrete $O_1 = X = \{x_1, x_2, x_3\}$, the only non-empty open set. But then $$(x_3,3) \in O_1 \times O_2 \subseteq O$$ as well and $(x_3,3)$ lies in the graph of $f$. As $O$ containing $(x_1,3)$ was arbitary, we have that $(x_1, 3) \in \overline{\Gamma(f)}\setminus \Gamma(f)$, so the graph of $f$ is not closed in $X \times Y$.
So this example is no counterexample against the valid theorem:
as the closedness hypothesis is not satisfied.