Is there always a non-abelian group of order $3q$ where $q$ is not squarefree? Suppose $p = 3q$ and $q$ is not square-free, how do I show that there is always a non-abelian group of order p? Should I construct it using semi-direct product? 
 A: Semidirect products will certainly do it.
It suffices to show that there are always nonabelian groups of order $3p^2$ with $p$ a prime. Indeed, if this is true and $q$ is not square free, then we can write $q=p^2r$ for some prime $p$ and some integer $r$; then taking $G\times C_r$, where $G$ is nonabelian of order $3p^2$ and $C_r$ is cyclic of order $r$ will give you a nonabelian group of order $3p^2r=3q$.
For $p=2$, we can take $A_4$, the alternating group of degree $4$, which has order $12$.
For $p=3$, we can take the Heisenberg group of $3\times 3$ upper triangular matrices with $1$s in the diagonal and coefficients in $\mathbb{F}_3$, which is a nonabelian group of order $27$.
For $p\gt 3$, we have two cases: $p\equiv 1\pmod{3}$ and $p\equiv 2\pmod{3}$. For the first one, we use the following Lemma:
Lemma. Let $n$ be a positive integer greater than $1$, and let $C_n$ be the cyclic group of order $n$. Then $C_n$ has an automorphism of order $3$ if and only if $3|\phi(n)$, where $\phi$ is Euler's $\phi$ function.
Proof. If we identify $C_n$ with the additive group of integers modulo $n$, then every automorphism corresponds to a map $1\mapsto r$ where $\gcd(r,n)=1$. The order is the smallest $k$ such that $r^k\equiv 1\pmod{n}$. This is equivalent to looking at the multiplicative group of units modulo $n$, and finding the order of $r$ in that group. The multiplicative group of units modulo $n$ has order $\phi(n)$, hence has an element of order $3$ if and only if $3$ divides $\phi(n)$, by Lagrange's Theorem (for the "only if" clause) and Cauchy's Theorem (for the "if" clause). $\Box$
If $p\equiv 1\pmod{3}$, then $C_p$ has an automorphism of order $3$ (since $\phi(p) = p-1$ is a multiple of $3$); this means that there is a group of order $3p$ that is nonabelian (a semidirect product $C_p\rtimes C_3$); hence we can construct a nonabelian group of order $3p^2$ as $(C_p\rtimes C_3)\times C_3$.
So we are reduced to the case in which $p\gt 3$ and $p\equiv 2\pmod{n}$. We cannot do what we did above, because all groups of order $3p$ are abelian (in fact, cyclic), which can be proven using the Sylow Theorems and a bit of extra work; neither can we get a nonabelian group of order $3p^2$ by using $C_{p^2}$, because, again by Sylow's Theorems it would have to be a semidirect product, but $C_{p^2}$ has no automorphism of order $3$, so again we get just the cyclic group of order $3p^2$. 
So instead we will use a semidirect product with normal subgroup $C_p\times C_p$.  Consider the group $C_p\times C_p$; write $p=3k+2$; we are looking for an automorphism of order $3$.  Look at the map $C_p\times C_p\to C_p\times C_p$ given by $(a,b)\mapsto (a,b+(k+1)a)$. This is indeed an automorphism (easy check), and the order is exactly $3$ (again, easy check). This automorphism lets us construct a nonabelian group $(C_p\times C_p)\rtimes C_3$ of order $3p^2$.
So we have constructed a group of order $3p^2$ for every prime $p$, and we are done.
