Topology such that function is continuous if and only if the restriction is. Let $X$ be a topological space and $A \subset X$. If $f : X \to Y$ is continuous, then $f|_A$ is automatically continuous (where $A$ has been equipped with the subspace topology). What about the converse? That is, for a fixed $A \subset X$, is there a topology on $X$ such that $f : X \to Y$ is continuous whenever $f|_A : A \to Y$ is?
 A: Any function $f : X \to Y$ with $X$ discrete is continuous.
For general $X$ and $Y$, for the converse to hold, you need $A$ to be an open subset of $X$. To see why, let $f = 1_A : X \to \{0,1\}$ be the indicator function
$$1_A(x) = \begin{cases} 1 & \text{if}\ x \in A \\ 0 & \text{otherwise} \end{cases}$$
and endow $\{0,1\}$ with the discrete topology. Then $f|_A$ is constant, hence continuous, and so $A = f^{-1}(\{1\})$ is open in $X$.
A: What you are searching for is the so-called final topology. Imagine you have a set $X,$ a space $A$ and a map $i:A\to X.$ Then you can equip $X$ with a topology such that every function $g:X\to Y$ into a space $Y$ is continuous if and only if $g\circ i:A\to Y$ is continuous. It is easy to prove that a topology with this property is unique. We can also show that it exists, namely the open sets in $X$ are defined to be the sets $U$ such that $i^{-1}(U)$ is open in $A.$
In the case that $A$ is a subspace of $X$ and $i:A\hookrightarrow X$ is the embedding, then the restriction $f|_A$ can be expressed as the composition $f\circ i.$ Then the final topology will have as open sets all sets $U$ of $X$ such that $i^{-1}(U)=U\cap A$ is open in $A.$
