This is exercise 15.11(d) in C. Kosniowsky book A first course in algebraic topology:
Prove that two continuous mappings $\varphi,\ \psi:X\to Y$, with $\varphi(x_0)=\psi(x_0)$ for some point $x_0\in X$, induce the same homomorphism from $\pi(X,x_0)$ to $\pi(Y,\varphi(x_0))$ if $\varphi$ and $\psi$ are homotopic relative to $x_0$.
Which is easy to solve. We were asked to prove the converse but, is it true to begin with? If so, is it an standar exercise or thought one?
Hint: Consider $\phi\colon S^2\to S^2$ the identity map.