Direct Product of a Group and itself Let A be a cyclic group with prime order p. Then the direct product $A\times A$ should have order $p^{2}$ according to wikipedia. 
http://en.wikipedia.org/wiki/Direct_product_of_groups#Elementary_properties
However I found this theorem in the book that states for subgroups H,K, of G that 
$ o(HK) = o(H)o(K)/((o(H \cap K) ) $ 
But $A$ is a subgroup of $A$ and $A \cap A = A$ so then  $ o(AA) = o(A)o(A)/o(A) = o(A) $
The last result makes sense to me, as $AA = A$. 
Maybe I'm confused about something. The external direct product $A\times A$ is isomorphic to the internal direct product $AA$, but I'm getting different orders for them. 
What am I doing wrong ?
 A: There are certain conditions that have to be satisfied for a group to be considered an internal direct product of two subgroups. 
Let $G$ be a group and let let $H$, $K$ be subgroups. Then $G$ is the internal direct product of $H$ and $K$ if $G=HK$, $H\cap K =1$ and $hk=kh$ for all $k\in K$, $h\in H$. In this case your order formula gives the correct order. In your example $A\cap A$ has nontrivial intersection so it cannot be considered an internal direct product. The idea here is that every element can be expressed uniquely in the form $g=hk$ and $(h_1k_1)(h_2k_2)=(h_1h_2)(k_1k_2)$, which makes the isomorphism to the external direct product much clearer.
In general multiplying two groups may not even be a group, though if one is normal it will be, but it still may not be a direct product. Look up semidirect product
A: There are a couple of notions in play here. The internal direct product, the external direct product, and the internal (not necessarily direct) product.
The thing you are interested in is the external direct product. It is defined as follows: Let $G$ and $H$ be groups. The external direct product of $G$ and $H$, written $G\times H$, is defined to be the group that has the cartesian product $G\times H$ as underlying set, and where the multiplication is given by $(g,h)(g',h') = (gg',hh')$. It is then clear that $|G\times H| = |G||H|$.
The internal product of subgroups is the following: Let $G$ be a group and $H$ and $K$ subgroups of $G$. Define $HK = \{hk | h\in H, k\in K\}$. This is now a subset of $G$ of order $\frac{|H||K|}{|H\cap K|}$ but it need not be a subgroup.
The internal direct product is the following: If $H$ is a group with normal subgroups $H$ and $K$ such that $|H\cap K| = 1$ and such that $HK = G$ then we say that $G$ is the internal direct product of $H$ and $K$.
The connection between the internal and external direct products is the following: If $G$ is a group which is the internal direct product of two normal subgroups $H$ and $K$, then $G$ is isomorphic to the external direct product $H\times K$ via the map $\varphi: H\times K\to G$ given by $\varphi(h,k) = hk$. Similarly, the external direct product $H\times K$ is the internal direct product of the two subgroups $\{(h,1) | h\in H\}$ and $\{(1,k) | k\in K\}$.
For the specific question, just because two groups are "the same", they can still form an external direct product as described above and then the two subgroups $\{(a,1) | a\in A\}$ and $\{(1,a) | a\in A\}$ are isomorphic but not the same, and in fact they intersect trivially.
A: If $H$ and $K$ are subgroups of $G$, then one of the requirements for $HK = \{xy : x\in H, y\in K\}$ to be an internal direct product is that $H \cap K = \{1\}$. So the only way $A \times A=A^2$ could be an internal direct product would be if $A =\{1\}$. 
As an external direct product, $G = A \times A = \{(x,y) : x, y \in A\}$.
The subgroups H = $A \times \{1\}$ and $K = \{1\}\times A$ are both "copies" of the group $A$.
Note that $H \cap K = \{(1,1)\}$, and $o(H)=o(K)=o(A)=p$.
$o(G) = o(H \times K) = \dfrac{o(H) \ o(K)}{o(H \cap K)}= o(A)^2=p^2.$
