<s>[INST] Finding a basis for this subspace of $n\times n$ matrices $M(n,\mathbb{F})$ denotes the set of all $n\times n$ matrices with entries in $\mathbb{F}$. 

Assume that $M(n,\mathbb{F})$ is a vector space over $\mathbb{F}$. Suppose $(\mu_{ij}) \in M(n,\mathbb{F})$ where $\mu_{ij} \mu_{ji}=1$ for all $i,j$. Let $U = \{(m_{ij})\in M(n,\mathbb{F}): m_{ij} = \mu_{ij}m_{ij} \text{ for all } i,j\}$. 
Suppose $\mu_{ii}=1$ for all $i$; find a basis for $U$ and find the dimension of $U$.

I wrote out few cases (when $n = \{2, 3, 4\})$ and these help me see that the dimension of $U$ should be given by the expression $\frac12 n(n+1)$.
Case $n=2$:
$\begin{pmatrix}
m_{11} & m_{12} \\
m_{21} & m_{22}
\end{pmatrix} =
\begin{pmatrix}
m_{11} & m_{12} \\
\mu_{21}m_{12} & m_{22}
\end{pmatrix}$
Case $n=3$:
$\begin{pmatrix}
m_{11} & m_{12} & m_{13} \\
m_{21} & m_{22} & m_{23} \\
m_{31} & m_{32} & m_{33}
\end{pmatrix} =
\begin{pmatrix}
m_{11} & m_{12} & m_{13} \\
\mu_{21}m_{12} & m_{22} & m_{23} \\
\mu_{31}m_{13} & \mu_{32}m_{23} & m_{33}
\end{pmatrix}$
Case $n=4$:
$\begin{pmatrix}
m_{11} & m_{12} & m_{13} & m_{14} \\
m_{21} & m_{22} & m_{23} & m_{24} \\
m_{31} & m_{32} & m_{33} & m_{34} \\
m_{41} & m_{42} & m_{43} & m_{44}
\end{pmatrix} =
\begin{pmatrix}
m_{11} & m_{12} & m_{13} & m_{14} \\
\mu_{21}m_{12} & m_{22} & m_{23} & m_{24} \\
\mu_{31}m_{13} & \mu_{32}m_{23} & m_{33} & m_{34} \\
\mu_{41}m_{14} & \mu_{42}m_{24} & \mu_{43}m_{34} & m_{44}
\end{pmatrix}$
Doing the following
$$\begin{pmatrix}
m_{11} & m_{12} \\
m_{21} & m_{22}
\end{pmatrix} =
\begin{pmatrix}
m_{11} & m_{12} \\
\mu_{21}m_{12} & m_{22}
\end{pmatrix}=
\begin{pmatrix}
m_{11} & 0 \\
0 & 0
\end{pmatrix} +
\begin{pmatrix}
0 & m_{12} \\
\mu_{21}m_{12} & 0
\end{pmatrix}+
\begin{pmatrix}
0 & 0 \\
0 & m_{22}
\end{pmatrix}$$
we can see that the $2\times 2$ matrices in $U$ are spanned by 3 linearly independent matrices, which agrees with the dimension listed above. Repeat this process for greater dimensions. Essentially my solution depends greatly upon the reader picking up on the pattern.
QUESTION: Is there a better way to present the solution to this problem?
 [/INST] Hint:
If $D$ is the diagonal and $U$ is the upper triangular part you can write
$$M = D+U+ K_1 U^T K_2$$
Now can you find $K_1,K_2$ matrices in terms of the $\mu$s which accomplish what you want?
</s>