# question about 'factor_out'

In my recent study, I encounter the following problem:

{A,B,C,D}::NonCommuting.
ex:=A B (a-b)+B A (b-a)+A C (a-c)+C A (c-a)+B C (b-c)+C B (c-b);


How to simplify the expression above? i.e. get the result
$$(AB-BA)(a-b)+(AC-CA)(a-c)+(BC-CB)(b-c)$$

edited

Remember that you need to write either a space or a * character to indicate products. Also, NonCommuting is spelled with a single t.

What do you want to do with this? You can distribute(_) this, but there isn't much else you can simplify given that the capital symbols do not commute with each other.

answered by (50.9k points)

Sorry for my typo. I want to extract the scalars in the following expression (the matrices outside the brackets are noncommuting)

I have written following code

substitute(_,$A?? (B??)+ C?? (D??)|B??+D??=0->(A??-C??) B??$);


but it's useless.

I don't understand what you want to do. Can you write down the expression that you would like to end up with?

I have known how to solve it. Only need to combine multiplythrough ,zoom and factorout.