In this question: Different definitions of the cross entropy loss function, two different definitions of cross-entropy cost function are proposed:
$$ C = -\frac{1}{n} \sum_x \sum_j(y_j \ln a_{j}^{L})$$ and $$C = -\frac{1}{n} \sum_x \sum_j (y_j \ln a_{j}^{L} + (1-y_j) \ln(1-a_{j}^{L})).$$
The analysis in the answer to the question I referred to shows that for binary classification (j=2), given that $ \sum_j a_j = 1$ and $ y $ is a one-hot vector, it holds that: $$ C = -\frac{1}{n} \sum_x \sum_{j=1}^2 (y_j \ln a_j) = -\frac{1}{n}\sum_x y_1\ln a_1 + y_2 \ln a_2 = \\ -\frac{1}{n} \sum_x y_1 \ln a_1 + (1 - y_1) \ln (1 - a_1).$$
However, I don't see how this analysis shows that the 2 definitions are equivalent given the assumptions, because in the second definition, if we take $j=2$, it yields: $$C = -\frac{1}{n} \sum_x [y_1 \ln a_1^L + (1 - y_1) \ln (1 - a_1^L) + y_2 \ln a_2^L + (1 - y_2) \ln (1 - a_2^L)].$$
Moreover, I would like to show that the definitions are equivalent for any number of output neurons, not just for 2 neurons.