# Multiplying only diagonal elements of a matrix

I'm dealing with the following problem:

Suppose that I gave a upper diagonal matrix A of the form: $$A= \begin{bmatrix} a_{11} & a_{12}&\dots &a_{1n}\\ 0 & a_{22}&\dots &a_{2n} \\ \vdots & \vdots&\dots &\vdots\\ 0 & 0&\dots &a_{nn} \end{bmatrix}$$

And a matrix $$A'$$ that is $$A$$ with only the diagonal elements multiplied by values $$u_1,u_2,\dots,u_n$$, but the upper diagonal elements stay intact, that is: $$A' = \begin{bmatrix} u_1 a_{11} & a_{12}&\dots &a_{1n}\\ 0 & u_2 a_{22}&\dots &a_{2n} \\ \vdots & \vdots&\dots &\vdots\\ 0 & 0&\dots &u_n a_{nn} \end{bmatrix}$$

How can I express $$A'$$ in terms of $$A$$?

Is there a way to express it in the form $$A' =UA$$? But then, what is the form of the matrix U?

• $A' = \begin{bmatrix} u_{1} & 0&\dots &0\\ 0 & u_{2}&\dots &0 \\ \vdots & \vdots&\dots &\vdots\\ 0 & 0&\dots &u_{n} \end{bmatrix}\begin{bmatrix} a_{11} & 0&\dots &0\\ 0 & a_{22}&\dots &0 \\ \vdots & \vdots&\dots &\vdots\\ 0 & 0&\dots &a_{nn} \end{bmatrix}+\begin{bmatrix} 0 & a_{12}&\dots &a_{1n}\\ 0 & 0&\dots &a_{2n} \\ \vdots & \vdots&\dots &\vdots\\ 0 & 0&\dots &0 \end{bmatrix}$. You got to isolate the diagonal elements and then multiply I guess. – Yadati Kiran Nov 22 '18 at 17:45
• Just calculate $U=A'A^{-1}$ – Widawensen Nov 22 '18 at 17:51
• How about \eqalign{ A' &= A + {\rm Diag}(u\!-\!1){\,\rm Diag}(A) \cr U &= A'A^{-1} = I + {\rm Diag}(u\!-\!1){\,\rm Diag}(A)A^{-1} \cr } – greg Nov 22 '18 at 18:01
• @Widawensen I need something that does not involve $A'$ – A.T Nov 22 '18 at 18:08
• @ArthurT Anyway, the result is diag$(u_1,u_2,u_3)$ + some nilpotent matrix with more complicated entries. – Widawensen Nov 22 '18 at 18:19