1. Introduction
Nonlinear matrix equations arise in many scientific and engineering fields. Seeking their solutions is a difficult task [
1]. In this paper, we are interested in solving the nonlinear matrix equation of the form
      
      where 
A is a given nonzero complex matrix. Matrix Equation (
1) is called the Yang-Baxter-like matrix equation (see [
2,
3,
4,
5,
6,
7,
8,
9]), termed YBME for short, since it originates from physics. Matrix Equation (
1) has the same form as the well-known Yang–Baxter equation, which first arose in two independent papers by Yang [
10] and Baxter [
11]. Recently, Kumar et al. [
12] investigated new solution sets for the Yang-Baxter-like matrix equation by using a class of generalized outer inverses of a matrix. Jiang et al. [
13] proposed a zeroing neural network dynamical system approach for solving the time-varying Yang–Baxter matrix equation.
It is evident that YBME (
1) is a symmetric matrix equation concerning a known matrix 
A and an unknown matrix 
X. Although YBME (
1) looks simple in format, it is not easy to solve for a general matrix 
A since it is equivalent to solving a quadratic system of 
 equations in 
 variables. So far, only for a few matrices with a special structure (f.g. [
2,
3,
4,
5,
6]) can all commutable solutions of Equation (
1) be obtained, i.e., solutions satisfying 
.
In this paper, our aim is to find all solutions of YBME (
1) with an idempotent matrix 
A, that has already been provided in [
5]. However, the idea of our approach is novel. We do not need to use and compute the Jordan canonical form of 
A as in some previous works, such as [
2,
3,
4,
5,
6,
7,
8,
9]. Our analysis and method to construct the solution set are based on simple sufficient and necessary conditions that we derive for a matrix to be a nontrivial solution of YBME (
1). In particular, we construct all commuting solutions.
The rest of the paper is organized as follows. In 
Section 2, we present some properties of the idempotent matrices. In 
Section 3, we first derive simple sufficient and necessary conditions for a matrix being a nontrivial (commuting, non-commuting) solution of YBME (
1), and then analyze and construct the set that contains all the (commuting, non-commuting) solutions of YBME (
1). Finally, in 
Section 4, we provide an example.
  2. Preliminaries
In this section, we first provide some properties of the idempotent matrices that are needed for our analysis later.
Let 
A be an 
 idempotent matrix with rank 
r, satisfying 
 and 
. We assume that 
 to avoid the two trivial cases 
 or 
. In fact, when 
, YBME (
1) is zero. When 
, YBME (
1) reduces to 
, whose solution is any idempotent matrix. That is to say, if we denote the set of all the solutions of the matrix for equation 
 as
      
      we know that 
 is the set of all the idempotent matrices of order 
n.
It is widely known that any square matrix 
A with rank 
r has the spectral decomposition in the form
      
      where 
 and 
 are of full rank. For notational convenience, in the following, we will denote
      
      where 
 and 
 form the basis of the null space of 
 and 
, respectively. Therefore, we have 
 and 
.
Lemma 1. Let , where U and V are two  () complex matrices of full column rank; then, A is a singular idempotent matrix if and only if .
 Proof.  Since , . Thus, A is an idempotent matrix if and only if .    □
 According to Lemma 1, we easily verify that
      
      where
      
Now, we begin to find solutions of YBME (
1) with an idempotent matrix.
Lemma 2. Let  be an  idempotent matrix with rank r, and let E be a  matrix, then  is a (commuting) solution of YBME (1) if and only if E is an (  ) idempotent matrix.  Proof.  Let 
, notice that 
. Thus we have
        
So, 
X is a solution of YBME (
1) if and only if 
, i.e., 
E is an idempotent matrix. Further, since 
, 
X commutes with 
A.    □
 Lemma 3. Let  be an  idempotent matrix with rank r, then for any  matrix F,  is a commuting solution of YBME (1).  Proof.  In fact, let 
, notice that 
 and 
, so we have
        
So, 
X is a commuting solution of YBME (
1).    □
   3. All the Solutions
In this section, we find all the solutions 
X of YBME (
1) with an idempotent matrix based on simple sufficient and the necessary conditions for a matrix being a nontrivial (commuting, non-commuting) solution. We first provide a lemma.
Lemma 4. If  where U and V are two  complex matrices of full rank such that , then the two matricesare nonsingular.  Proof.  To show the matrix  is nonsingular, we only need to show that the linear system  only has a zero solution. In fact, since  and , we have . The linear system  becomes . Further, since  is of full column rank, we derive from  that . So,  has only a zero solution; thus, P is nonsingular. Similarly, we can show that Q is nonsingular.    □
 Since 
P and 
Q, defined in (
7), are nonsingular, we can easily show that for an arbitrary 
 matrix 
X, there is an 
 matrix 
Z such that
      
      where 
, 
, 
 and 
 are 
, 
, 
 and 
 matrices, respectively. Now, we present our main results.
Theorem 1. Let  be an  idempotent matrix with rank r, and , defined in (8), an  complex matrix. Then, X is a solution of YBME (1) if and only if , , and  satisfy the following equations simultaneously:  Proof.  Notice that 
, 
 and 
, in a simple calculation lead to
        
        and 
. Thus,
        
Notice that 
P and 
Q are nonsingular; therefore, 
X is a solution of YBME (
1) if and only if 
, 
 and 
 satisfy (
9).    □
 In light of the previous result, note that the matrix 
 is completely arbitrary. In terms of Theorem 1, we can obtain all the solutions of YBME (
1) by solving (
9) for the matrices 
 (
). Denote the solution set of (
9) as
      
      or equivalently,
      
In the following, we derive the set  using the set .
(i) If 
, then all the solutions of (
9) are 
.
(ii) If 
, then all the solutions of (
9) are 
.
(iii) If , then we can assume that  k where E, and F are two  matrices of full column rank such that , .
Let 
 and 
, where 
 are two 
 matrices whose columns form the basis of the null space of 
 and 
, respectively. Then, we have 
 for the arbitrary 
 matrix 
 and arbitrary 
 matrix 
. Thus, when 
, we obtain the set of all the solutions of (
9) is
      
So, we find that the set 
 is
      
Corollary 1. Let  be an idempotent matrix with rank r; then, all the solutions of YBME (1) can be expressed as  in (8), where , and  are arbitrary.  For the commuting solutions of YBME (
1), we have an optimal result.
Theorem 2. Let , where U and V are two  complex matrices of full column rank such that . Then, an  complex matrix X is a commuting solution of YBME (1) if and only ifwhere E is any  idempotent matrix, and F is any  matrix.  Proof.  Sufficiency. Using Lemmas 2 and 3, we easily verify that when 
E is an idempotent matrix; for arbitrary 
F, 
 is a commuting solution of YBME (
1).
Necessity. Let 
, where 
Z is partitioned as in (
8). A simple calculation leads to
        
		If 
X commutes with 
, then since 
P, 
Q are nonsingular, we obtain 
 and 
. Thus,
        
        where 
 is an 
 matrix, 
 is an 
 matrix.
To prove necessity, we still need to show that if 
X in (
13) is a commuting solution of YBME (
1), 
 must be an idempotent matrix.
In fact, let 
; we easily verify that 
. Thus, it is clear that since 
X is assumed to be a solution of YBME (
1), 
 needs to be an idempotent matrix. Let 
 and 
, whereby the necessity is proved.    □
 Remark 1. Theorem 2 can be seen as a corollary of Theorem 1, and Lemmas 1 and 2 are corollaries of Theorem 2.
   4. An Illustration Example
We provide an example to illustrate the process of constructing the solution set of YBME (
1).
Example 1. We easily obtain a spectral decomposition of A:  with  and . Since , we know that A is an idempotent matrix of rank 2.
A simple calculation leads to  and .
Using Corollary 1, all the solutions of YBME (1) arewhere α is an arbitrary number, E is a  matrix, and  are 2-dimensional vectors.  is in the set In the above set,  are any two 2-dimensional vectors satisfying .  are two 2-dimensional vectors satisfying .  are numbers.
According to Theorem 2, all the commuting solutions of YBME (1) are as follows:where α is an arbitrary complex number, E is any  idempotent matrix, that is, . Here, more specifically,  means that , and  are arbitrary 2-dimensional vectors satisfying .