# How to define pure functions in matrix form?

I want to define pure functions x(#1,#2) and y(#1,#2) like But they aren't proper pure functions in the current form. How to modify the code?

• You are missing an ampersand &. Example. Commented Mar 12, 2023 at 10:28
• thanks! In your example, how can one define x(#1,#2) and y(#1,#2) separately rather than x and y as a vector together? Commented Mar 12, 2023 at 10:48

You have to reapply Function separately for x and y, for example:

{x, y} = Function @@@ (({{Cos[a], Sin[a]},{-Sin[a], Cos[a]}}) . ({{#1},{#2}}))


If you want to have a "column vector" like notation on the left side, you have to properly match the levels, for example:

{{x}, {y}} = List@*Function @@@ ({{Cos[a], Sin[a]}, {-Sin[a], Cos[a]}} . {{#1}, {#2}});

{{x}, {y}} = Map[Function, {{Cos[a], Sin[a]}, {-Sin[a], Cos[a]}} . {{#1}, {#2}}, {2}];


• many thanks! I'm curious why for column vectors it's so much more work, as simply mimicking the row vector approach will yield an error saying: Lists {X} and Cos[a] #1+Sin[a] #2& are not the same shape. Commented Mar 12, 2023 at 11:16