writing matrix with hat in mathmode

I want to know the difference between:

$\hat{\mathbf{M}}$  % hat is not bold
and
$\mathbf{\hat{M}}$ % hat is bold


What is correct way (bold/normal). If both what are cases when I should use bold and when normal hat.

• It depends on whether you want the hat to be bold or not. However the first should be $\hat{\mathbf{M}}$ – egreg Apr 26 '16 at 19:26
• @Mico, I wanted to know when should I use bold hat and when normal hat. – user31177 Apr 26 '16 at 19:35
• Whether or not the hat symbol is supposed to be bold as well really depends on what M, \hat{M}, \mathbf{M}, and thus also \hat{\mathbf{M}} and \mathbf{\hat{M}} are supposed to mean. – Mico Apr 26 '16 at 19:37

1. If the « hat » means « matrix M », then the hat is not part of the name of the matrix. It just says that M is a matrix. In this case, you should use \hat{\mathbf{M}}.
2. However, if you call the matrix « M̂ », that is, the « hat » is actually a part of the name, then you should use \mathbf{\hat{M}}.