Showing that $k$-algebra homomorphism between local rings is a local ring homomorphism Let $k$ be a field. Then $(k,\text{id}_k)$ is a $k$-algebra. Let two further $k$-algebras $(A,\varphi_A)$ and $(B,\varphi_B)$, such that both are local as rings,
and a $k$-algebra homomorphism $f:A\rightarrow B$, i.e. $\varphi_B=f\circ\varphi_A$,
be given.
Assume that the induced ring homomorphism $q:k\rightarrow B/\mathfrak{m}_B$ is a bijection.
Here $\mathfrak{m}_B$ denotes the maximal ideal of $B$.
Now I have to show that $f$ is actually a local ring homomorphism.
I am having trouble doing this! My idea was to show that $\mathfrak{m}_A$ will be mapped to the zero element in $B/\mathfrak{m}_B$ under the composition$A\rightarrow B\rightarrow M/\mathfrak{m}_B$, but I don't know how.
Any help/ hint/ advice is appreciated!
 A: If I understand correctly, $q$ is the composition of $\varphi_B$ with the quotient map to $m_B$. To be honest, you should give the precise definitions in the question.
We want to show that $f(m_A)\subseteq m_B$. So let $x\in m_A$. By assumption there is some $y\in k$ such that $q(y)=\varphi_B(y)+m_B=f(x)+m_B$. Thus $\varphi_B(y)-f(x)\in m_B$. But note that:
$\varphi_B(y)-f(x)=f(\varphi_A(y))-f(x)=f(\varphi_A(y)-x)$
So we have $f(\varphi_A(y)-x)\in m_B$. This means that the element $f(\varphi_A(y)-x)$ is not invertible in $B$. Since homomorphisms map invertible elements to invertible elements we conclude that $\varphi_A(y)-x\in A$ is not invertible, i.e $\varphi_A(y)-x\in m_A$. Since $x\in m_A$ it follows that $\varphi_A(y)\in m_A$ as well, i.e $\varphi_A(y)$ is not invertible. Again, it follows that $y\in k$ is not invertible, but since $k$ is a field this means $y=0$. But then $\varphi_B(y)=0$, and so $f(x)=f(x)-\varphi_B(y)\in m_B$.
A: We have the following diagram:

We know all of the map are $k$-algebra homomorphism, therefore $\phi$ is $k$-algebra homomorphism  from $k \to B/{\frak{m}}_{B}\cong k$. This map has to be identity map.
Therefore we have $A\to B/{\frak{m}}_B$ being surjective map, therefore by the first isomorphism theorem the kernel of this map has to be a maximal ideal, in the local ring is ${\frak{m}}_A$ therefore $f:A \to B$  maps ${\frak{m}}_A$ into ${\frak{m}}_B$
