Semidirect Products and the definition of a function. When we say $f: X \rightarrow Y$ is a function, we mean that we take elements in $X$ and end up with elements in $Y$, right? 
But semidirect products are confusing me...
Definition
Let $\alpha: K \rightarrow \text{Aut}(H)$ be a homomorphism. By the semidirect product of $H$ and $K$ with respect to $\alpha$, written $H \rtimes_{\phi} K$, we mean the set $H\times K$ with the binary operation given by setting $$(h_1, k_1) \cdot (h_2, k_2) = (h_1, \alpha(k_1)(h_2), k_1k_2).$$
This is confusing me, because we are not taking elements from K and ending up with elements in $\text{Aut}(H)$...since $(h_1, k_1) \not\in K$. 
Can anybody please clarify this for me?
Thanks in advance 
 A: Be clear that $\alpha$ is the mapping from $K$ to Aut$(H)$.
Now, you are dealing with the set $H\times K$. You want to define a group structure on that set, so you need an operation from $(H\times K)\times(H\times K)$ to $H\times K$. So you want an operation in which, it is of the form $(h_1,k_1)\cdot (h_2,k_2)=(h_3,k_3)$.
Compare it with your definition. On the right hand side, $(h_1\alpha(k_1)(h_2), k_1k_2)$.
Note that $\alpha(k_1)\in$ Aut$(H)$, which means $\alpha(k_1): H\mapsto H$. Therefore, $h_1\alpha(k_1)(h_2)\in H$. $k_1k_2\in K$ is obvious.
A: In the expression, $\alpha(k_1)\in Aut(H)$, and then $\alpha(k_1)(h_2)\in H$, since it is the previous map evaluated at a point of $H$.
I think there is an extra comma in your right-hand side expression... you should wind up with an element of $H$ on the left and $K$ on the right.
A: Actually, we are: $\alpha$ is a function from $K$ to $\operatorname{Aut}(H)$, so $\alpha(k_1)$ is an element of $\operatorname{Aut}(H)$, which we then want to apply to $h_2$.
So $\alpha(k_1)(h_2)$ is an element of $H$, which is good, because what the right-hand side of your expression should actually say is $(h_1 \alpha(k_1)h_2, k_1k_2)$, and this is an element of the cartesian product of $H$ and $K$, which is what we need in order to have closure under multiplication.
A: As others have mentioned the idea is that your overall homomorphism $K\rightarrow \operatorname{Aut}(H)$ is a function to a group of functions.  I'd like to add that I prefer to define this like $\Phi:K\rightarrow \operatorname{Aut}(H)$ by $\Phi(h)=\phi_h$, so that we end up with $$(h_1, k_1) \cdot (h_2, k_2) = (h_1 \phi_{k_1}\!(h_2), k_1k_2)$$ which tends to reduce this kind of confusion.
