newcommand and math environement
So I've created a latex `command` using `newcommand`. This is its definition

    \newcommand{\twopartdef}[3]
    {
	\left\{
		\begin{array}{ll}
			#1 & \mbox{if } #2 \\
			#3 & \mbox{otherwise}
		\end{array}
	\right
    }

But when I try to use the command with this example

    f$(x)$ = \twopartdef{$\lbrace \alpha \rbrace}{$x >$ 10}{\lbrace \beta \rbrace}

Latex tells me that it added the symbol `$` because it was unmatched.. 

What am doing wrong? What corrections should I make?
newcommand and math environement
===

So I've created a latex `command` using `newcommand`. This is its definition

    \newcommand{\twopartdef}[3]
    {
	\left\{
		\begin{array}{ll}
			#1 & \mbox{if } #2 \\
			#3 & \mbox{otherwise}
		\end{array}
	\right
    }

But when I try to use the command with this example

    f$(x)$ = \twopartdef{$\lbrace \alpha \rbrace}{$x >$ 10}{\lbrace \beta \rbrace}

Latex tells me that it added the symbol `$` because it was unmatched.. 

What am doing wrong? What corrections should I make?