Let $X$ be a topological space. and suppose $B$ is a convex subset in $\mathbb{R}^n$. Prove that any continuous map $f: X \rightarrow B$ is null-homotopic.
My strategy is following the defintion of null-homotopic which is homotopic to constant function $c$.
To prove this find homotopoy $H$ satisfying \begin{align} H(t,0) = f(t) \in B \qquad H(t,1) = c \in \mathbb{R}^n \end{align} define $H$ as \begin{align} H(t,s) = (1-s) f(t) + s c\in \mathbb{R}^n \end{align} which is continuous and satisfies \begin{align} H(t,0) = f(t), \qquad H(t,1) = c \end{align}
Is this valid approach? I feel uncomfortable since in the above process i never used the concept of "convex" explicitly.
This is correct. The place you use convexity is in knowing that $H(t,s)\in B$ for all $(t,s)$ (remember, you need $H$ to be a map $X\times[0,1]\to B$, not just a map to $\mathbb{R}^n$!). Since $f(t)\in B$ and $c\in B$, $(1-s)f(t)+sc\in B$ by convexity. You probably want to mention this explicitly when writing up your solution, both to justify the fact that $H(t,s)\in B$ and to show your reader where you are using convexity.