# In logistic regression, why is the binary cross-entropy loss function convex?

I am studying logistic regression for binary classification.

The loss function used is cross-entropy. For a given input $$x$$, if our model outputs $$\hat{y}$$ instead of $$y$$, the loss is given by $$\text{L}_{\text{CE}}(y,\hat{y}) = -[y \log \hat{y} + (1 - y) (\log{1 - \hat{y}})]$$

Suppose there are $$m$$ such training examples, then the overall total loss function $$\text{TL}_{\text{CE}}$$ is given by

$$\text{TL}_{\text{CE}} = \dfrac{1}{m} \sum\limits_{i = 1}^{m} \text{L}_{\text{CE}} (y_i , \hat{y_i})$$

It is said that the loss function is convex. That is, If I draw a graph between the loss values wrt the corresponding weights then the curve will be convex. The material from textbook did not give any explanation regarding the convex nature of the cross entropy loss function. You can observe it from the following passage.

For logistic regression, this (cross-entropy) loss function is conveniently convex. A convex function has just one minimum; there are no local minima to get stuck in, so gradient descent starting from any point is guaranteed to find the minimum. (By contrast,the loss for multi-layer neural networks is non-convex, and gradient descent may get stuck in local minima for neural network training and never find the global optimum.)

How did they conclude conveniently that the loss function is convex? Is it by plotting or some other means?