## Background

I saw a question about determinants.

Suppose that $A$ and $B$ are singular and nonsingular matrices respectively. Simplify $\det((A+B)^2−(A−B)^2)$.

## Problem

A *wrong* solution with a vote of -2 is chosen by Daniel. Why can
this happen?

## Possible explanation

That’s because he’s correctly done the expansion until $\det(2AB + 2BA)$.

## Raison d’être of this post

Having spent time on typing a comment, I worry that it will automatically disappear in sooner or later if the accepted answer is deleted. Therefore, I back it up here.

Consider However, if $A = 0$ and $B = I_3$, then the answer is clearly zero. As a result, we

can’tdecude further from $\det(2(AB + BA))$.

## Lessons learnt

The generation of a random matrix/array of integers using
`randi([imin, imax], m, n)`

. For more details, you may read
GNU Octave’s manual.