# How to prove the cost function of a neural network with only linear activation functions is convex？

Is the cost function of a neural network with only linear activation functions a convex function with respect to its parameters? If it is, how to prove it?

• Linear functions are closed under composition; linear regression is convex under some assumptions. – Sycorax Mar 2 at 2:11

$$W_2(W_1x+b_1)+b_2=Wx+b$$
So, in the end, your equation is $$Wx+b=y$$, i.e. just a linear regression. The cost function is already convex, because it is norm-squared of an affine function. Also, more strongly, the problem is a convex problem.