I have the function $f$ which is holomorphic on the open unit disc $|z|<1$ and satisfies $|f(z)|\leq cos(\frac{\pi |z|}{2})$. I am asked to find $f$.
I know that I am supposed to use maximum modulus here, and I have a good feeling that $f(z)=0$ since near the boundary $|z|=1$, $cos(\frac{\pi |z|}{2})$ gets closer and closer to $0$. But I don't quite know how to say all of this rigorously. Also since I am not given that $f$ is holomorphic or continuous on the boundary $|z|=1$, I am finding it difficult to say something about how $f$ behaves near this boundary.
Use the maximum modulus principle on discs of increasing radius centered at 0, and use that as you noticed, the bound tends to $0$ there.
In other words, by the maximum modulus principle, for $0<r<1$, we have $$ \sup_{|z|\leq r}|f(z)|\leq \sup_{|z|=r}|f(z)|\leq\left|\cos\left(\frac{\pi r}{2} \right)\right| $$ Now take $r\uparrow 1$ and use that $\cos\left(\frac{\pi r}{2}\right) \downarrow 0$. So $f\equiv 0$, as you intuited.
edit: Some details. Fix $\epsilon>0$, $z_0\in D(0,1)$.
Find a $\delta>0$ so that $1-\delta<r<1\implies \left|\cos\left(\frac{\pi r}{2} \right)\right|<\epsilon$. Then, by the same chain of inequalities, $$ \sup_{|z|\leq 1-\frac{\delta}{2}}|f(z)|\leq \epsilon $$ We can find a $\delta'$ small enough so that $z_0\in D(0,1-\delta'/2)$ and the continuity estimate still holds, and $|f(z_0)|<\epsilon$.
Since $\epsilon>0$, $z_0$ were arbitrary, $f\equiv 0$ on $D$.