Change the trace of a Matrix I want to know if I have a matrix $A \in \mathbb{M}_{n\times n}(\mathbb{K}) $ and I want to change the trace multiplying it by a number $\beta \in \mathbb{K}$:
$$ A=\left( \begin{array}{ccc}
\alpha_{11} & ... & \alpha_{1n} \\
\vdots &  & \vdots \\
\alpha_{n1} & ... & \alpha_{nn} \end{array} \right) \to  B=\left( \begin{array}{cccc}
\beta \alpha_{11} & \alpha_{12} & ... & \alpha_{1n}  \\
\alpha_{21} &\beta\alpha_{22}  & & \vdots \\
\vdots &  & & \vdots \\
\alpha_{n1} & ... & ... & \beta\alpha_{nn} \end{array} \right)$$
There exist some $X \in \mathbb{M}_{n\times n}(\mathbb{K})$ s.t $A\times X = B$ and if it exist, what form does it have. Thanks
 A: As MathLover points out in comments, if $A$ is invertible, then the answer is yes.  Here's how to do it:
Write $B$ as $B= A + D$ where $D$ is the diagonal matrix (the trace adjustment), in your case $d_{ii} = (\beta-1)a_{ii}$.  Then you want to find some X so that $AX = B = (A+D)$.
Then, just solve for $X$.
\begin{align*}
AX &= A + D \\
A^{-1} AX &= A^{-1}(A+D) \\
X &= I + A^{-1}D
\end{align*}
In general, if $A$ is not invertible you can't guarantee that this can be done.  Take as a simple case $A=\mathbb{1}_{2,2}$ (the all-ones matrix, 2x2).  And take $B=A+I$ (i.e. multiply the diagonal of $A$ by 2).  If you write down the system of equations from $AX=B$ you'll quickly see it isn't possible to solve.
\begin{align*}
\left(\begin{array}{cc} 1 & 1 \\ 1 & 1 \end{array}\right) \left(\begin{array}{cc} a & b \\ c & d \end{array}\right) &= \left(\begin{array}{cc} 2 & 1 \\ 1 & 2 \end{array}\right) \\
\Rightarrow& a + c = 2 \\
& b + d = 1 \\
& a + c = 1 \\
\text{ and }& b + d = 2 \text{ contradiction.}
\end{align*}
