# Error while defining custom matrix function

I'm trying to define a custom matrix Ry with a parameter x, in Mathematica.

Ry[x_] = {{Cos[x/2], Sin[x/2]}, {-Sin[x/2], Cos[x/2]}}


However, when I execute the cell using Shift+Enter, I always get the same output no matter what value of x I plug in.

In[130]:  Ry[5]
Out[130]: {{Cos[1/2], Sin[1/2]}, {-Sin[1/2], Cos[1/2]}}


What am I missing?

• Probably you need to Clear[x] before defining your matrix. Or, use SetDelayed (:=) instead of Set (=). – Carl Woll May 27 at 18:04
• Thanks, Clear[x] solved the problem. That should be an answer! :) – Blue May 27 at 18:05