Center of $GL_n(\mathbb R)$ is the set of matrices $\lambda I$ I determined the set of all matrices $A$ such that $AB = BA$ for all $B$ in $GL_n(\mathbb R)$ to be the set of $\lambda I$. Now I'm not sure this is true. But quite sure. So I tried to prove it and it seems to work. But I'm not sure my proof is right. 
Please can somebody tell me if my proof is right?
I claim that $Z(GL_n(\mathbb R)) = \{\lambda I \mid \lambda \in \mathbb R\}$.
Note that if $D = \lambda I$ and $A$ is any matrix then
$$(DA)_{ij} = \lambda \sum_k \delta_{ik} a_{kj} = \lambda a_{ij}$$
and
$$(AD)_{ij} = \lambda \sum_k \delta_{kj} a_{ik} =  \lambda a_{ij}$$
So if $D$ is a diagonal matrix and $A$ any matrix then $AD = DA$.
Now the other direction: $Z(GL_n(\mathbb R)) \subseteq \{\lambda I \mid \lambda \in \mathbb R\}$.
Let $D$ be a matrix that commutes with all matrices: $AD = DA$. Now by contradiction let $D$ be the matrix  that is $\lambda$ on the diagonal and zero everywhere else except $D_{i_0j_0=1}$. Then because
$$ (AB)_{ij} = \sum_k a_{ik}b_{kj}$$
and 
$$ (BA)_{ij} = \sum_k b_{ik}a_{kj}$$
we have
$$ (AB)_{ij} = \sum_k a_{ik}b_{kj}$$
and then
$$ (DA)_{i_0j_0} = d_{i_0i_0}a_{i_0j_0} + d_{i_0j_0}a_{j_0j_0} = \lambda a_{i_0j_0} + a_{j_0j_0}$$
$$ (AD)_{i_0j_0} = d_{i_0j_0}a_{i_0j_0} + d_{j_0j_0}a_{i_0i_0} = a_{j_0j_0} + \lambda a_{i_0i_0}$$
are not equal. 
 A: Take $$B=\mathrm{diag}(b_1,\dots,b_n)\quad \text{with }b_i\neq 0\text{ and }b_i\neq b_j$$ clearly$B\in Gl_n(\mathbb{R})$ 
Since $A,B$ commute $$BAe_i=ABe_i=b_iAe_i$$ hence $Ae_i=\lambda_i e_i$ because the eigenvalues of $B$ are not degenerate. So $A=\mathrm{diag}(\lambda_1,\dots,\lambda_n)$
Let $P_{ij}$ be the Permutation that exchanges the basis vector $e_i$ with $e_j$, note that $P_{ij}^{-1}=P_{ji}$ and therefore $P_{ij}\in Gl_n(\mathbb{R})$. Now we have
$$PAe_j=\lambda_jPe_j=\lambda_je_i$$
On the other hand
$$APe_j=Ae_i=\lambda_ie_i$$
So to commute with $P_{ij}$,  $\lambda_i=\lambda_j$. Since this applies to all $\lambda_i$, we can set$\lambda_1=\dots=\lambda_n=:\lambda$ and hence $A=\lambda I$ 
A: The first part is a correct proof of the statement
$$
\{\lambda I \mid \lambda \in \mathbb R\} \subseteq Z(GL_n(\mathbb R)) .
$$
This is the easy part.
For the second part you must prove
$$
Z(GL_n(\mathbb R)) \subseteq \{\lambda I \mid \lambda \in \mathbb R\}.
$$
This part is not correct. You have only shown that if $D \in Z(GL_n(\mathbb R))$ and $D$ is very special, then $D = \lambda I$. For a correct proof, choose a general $D \in Z(GL_n(\mathbb R))$ and consider very special matrices $A$, for example $A_{i_0j_0} = 1$ and $A_{ij} = 0$ for all other $(i,j)$. Work out $DA$ and $AD$ and see what you can do with that.
A: You can also do the proof by constructing a matrix $E$ , that has a $1$ in some off-diagonal term $e_{ij}$ and is zero elsewhere. Then , for any matrix $M$ in $GL(n;\mathbb R)$, we have: $$EM=(m_{ji}) ; ME=(m_{ij})$$, so that $E$ commutes only with matrices with $m_{ij}=m_{ji}$. So now we only need to show that there are matrices $M$ in $GL(n; \mathbb R)$ with $m_{ij} \neq m_{ji}$ (which should not be too hard), and then use the fact that $(M+E)(M')=ME+ME'$.
