Given a complex idempotent matrix A, we derive simple, sufficient and necessary conditions for X being nontrivial solution of the Yang-Baxter-like equation AXA = XAX, discriminating commuting solutions from non-commuting ones. On this basis, construct all nonlinear equation.