# Find a symmetric matrix $P$ that satisfies the matrix equation $PD+DP=-Q$

Let

$$D= \left[\begin{matrix} d_1 & 0 & 0 \\ 0 & d_2 & 0 \\ 0 & 0 & d_3 \\ \end{matrix}\right]$$

and

$$Q=\left[\begin{matrix} q_1 & q_2 & q_3 \\ q_2 & q_4 & q_5\\ q_3 & q_6 & q_7 \\ \end{matrix}\right]$$

Find a symmetric matrix $P$ that satisfies the matrix equation $PD+DP=-Q$.

How can I solve it? Help me solve it.

• I you could find a symmetric matrix $P$, wouldn't that mean that $Q$ is also symmetric since $-Q^T=D^TP^T+P^TD^T=-Q$. Sep 25 '16 at 12:53
• could you explain that in detail? Sep 25 '16 at 12:59
• but that was not symmetric matrix .....then how about supposing that if Q is symmetric matrix? Sep 25 '16 at 13:02
• So if a symmetric $P$ exists, then taking the transpose of the equation implies $Q$ is symmetric. Sep 25 '16 at 13:07

Using Einstein's summation convention and dropping the $-$ sign which is essentially useless:

$$q_{ij} = p_{ik} d_{kj} + d_{ik}p_{kj}$$

but $d_{ik} = d_{i}\delta_{ik}$ where $\delta_{ik}$ is 1 if $k=i$, $0$ otherwise so that:

$$q_{ij} = p_{ij} d_j + d_{i} p_{ij} = p_{ij} (d_i+d_j)$$

and finally $p_{ij} = q_{ij}/(d_i+d_j)$

Small (inefficient but hopefully clear) Julia code to check it:

tmp = randn(3,3)
P   = (tmp+tmp')/2 # make it symmetric
d   = randn(3)
D   = diagm(d)

Q = P*D + D*P

# check the relation P_{ij}=Q_{ij}/(d_i+d_j)

test = Q*0

for i=1:3
for j=1:3
test[i,j] = Q[i,j]/(d[i]+d[j])
end
end

println(norm(test-P))


should give you something < 1e-15

• Thank you , there is no choice... have to solve it one by one Sep 25 '16 at 13:39
• hm what do you mean? the solution $p_{ij}=q_{ij}/(d_i+d_j)$ is as explicit as you can get, additionally as was mentioned by @snulty you only need to compute 6 values since the matrix is symmetric.
– tibL
Sep 25 '16 at 13:45
• your answer was perfect to understand !. I mean I have to write factors by hand to show my prof. if he want . Never mind about that. thank you! Sep 25 '16 at 14:05