How to solve for $X$ in matrix equation $XA + X = 2B$? I am given homework where I have to solve for matrix $X$ equation $$B^{-1}XA = -B^{-1}X + 2E,$$
where $A$ and $B$ are known matrices and $E$ is the identity matrix.
I simplified it in the following way:
$$B[B^{-1}XA] = B[-B^{-1}X + 2E]$$  $$\implies XA = -X + 2B$$
$$\implies XA + X = 2B$$
I might have done something wrong till now, if so please tell.
Though what I really want to know is:
Does $X*A + X = X(A + 1)$ or $X*A + X = X(A + E)$ or something else?
 A: On the one hand, you have $$X= X E = 1X,$$
because both multiplication by a scalar $1$ and by an identity matrix $E$ would result in the same thing.
However, the expression $A+1$ (where $A$ is a matrix) has no sense (except for the case where $A$ is a $1\times 1$ matrix, but even in this case we are pushing it), because $1$ is real number and we can't add it to a matrix - these objects are of different nature;  remember, we don't add oranges to apples.
Therefore, for your equation, only the form $X(A+E)=2B$ is correct.
A: Yes, $XA + X = X(A+E) $ although  $I $ is usually used to denote the identity matrix. The number 1 is a scalar, not a matrix.
A: The correct simplification is indeed 
$$
XA + X = 2B \implies\\
X(A + E) = 2B
$$
as you can verify by distributing.  Note that $A + 1$ is not a meaningful expression, since we can add a matrix to a scalar directly.
A: We have the matrix equation in $X \in \mathbb R^{m \times n}$
$$X A + X = 2 B$$
where $A \in \mathbb R^{n \times n}$ and $B \in \mathbb R^{m \times n}$ are given. The matrix equation can be rewritten in the form
$$X (A + I_n) = 2 B$$
If $A + I_n$ is invertible, then the unique solution is
$$X = 2 B (A + I_n)^{-1}$$
If $A + I_n$ is not invertible, then vectorize the matrix equation and solve the resulting linear system
$$((A^T + I_n) \otimes I_m) \, \mbox{vec} (X)  = 2 \, \mbox{vec} (B)$$
Once the solution set in $\mathbb R^{mn}$ has been found, un-vectorize to obtain the solution set in $\mathbb R^{m \times n}$.
