Diagram of the subgroups of $D_4=\langle a,b:a^4=1,b^2=1,ba=a^3b \rangle $ I tried to make the diagram of the subgroups of $D_4=\langle a,b:a^4=1,b^2=1,ba=a^3b \rangle$

although,in my notes there is this one:

Which of them is right?
EDIT:
To find all the subgroups of $D_4$ I did the following:
$$<1>=\{1\}$$
$$<a>=\{1,a,a^2,a^3\}=<a^3>$$
$$<b>=\{1,b\}$$
$$<a^2b>=\{1,a^2b\}$$
$$<a^3b>=\{1,a^3b\}$$
$$<ab>=\{1,ab\}$$
$$<a^2>=\{1,a^2\}$$
$$<a,b>=\{1,a,b,ab\} \checkmark $$
$$<a,a^2b>=\{1,a,a^2b,a^3b\} \checkmark $$
$$<a,a^3b>=\{1,a,a^3b,b\} \checkmark$$
$$<a,ab>=\{1,a,ab,a^2b\} \checkmark$$
$$<a,a^2>=\{1,a,a^2,a^3\}=<a> \times $$
$$<a,a^3>=\{1,a,a^3 \}, ord=3 \nmid 8 \times$$
$$<b,a^2b>=\{1,b,a^2b,a^2\} \checkmark$$
$$<b,a^3b>=\{1,b,a^3b,a\}=<a,a^3b> \times$$
$$<b,ab>=\{1,b,ab,a^3\} \checkmark$$
$$<b,a^2>=\{1,b,a^2,a^2b\}=<b,a^2b> \times$$
$$<b,a^3>=\{1,b,a^3,ab\}=<b,ab> \times $$
$$<a^2b,a^3b>=\{1,a^2b,a^3b,a^3\} \checkmark$$
$$<a^2b,ab>=\{1,a^2b,ab,a\}=<a,ab> \times$$
$$<a^2b,a^2>=\{1,a^2b,a^2,b\}=<b,a^2b> \times$$
$$<a^2b,a^3>=\{1,a^2b,a^3,a^3b\}=<a^2b,a^3b> \times$$
$$<a^3b,ab>=\{1,a^3b,ab,a^2\} \checkmark$$
$$<a^3b,a^2>=\{1,a^3b,a^2,ab\}=<a^3b,ab> \times$$
$$<a^3b,a^3>=\{1,a^3b,a^3,b\} \checkmark$$
$$<ab,a^2>=\{1,ab,a^2,a^3b\}=<a^3b,ab> \times$$
$$<ab,a^3>=\{1,ab,a^3,a^2b\} \checkmark$$
$$<a^2,a^3>=\{1,a^2,a^3,a\}=<a> \times$$
Therefore:
The subgroups of $D_4$ are the following:
$\text{ ord }=8 :$ $$\ \ \ D_4$$
$\text{ ord }=4 :$ $$ \ \ \ <a>, \ <a,b>, \ <a,a^2b>, \ <a,a^3b>, \ <a,ab>, \ <b,a^2b>, \  <b,ab>, \\ <a^2b,a^3b>,  \ <a^3b,ab>,  \ <a^3b,a^3>,  \ <ab,a^3>$$
$\text{ ord }=2 :$ $$ \ \ \ <b>,  \ <a^2b>,  \ <a^3b>, \  <ab>,  \ <a^2>$$
$\text{ ord }=1 :$ $$ \ \ \ <1>$$
Is it right?
But...at the lattice from my notes there aren't so many subgroups...What have I done wrong?
 A: None of $b,ab,a^2b,$ or $a^3b$ is an element of $\langle a\rangle,$ so your diagram is incorrect. Keep in mind that not all subgroups are necessarily cyclic! However, it's a good idea to start by finding the cyclic subgroups. In particular, you should find that $$\langle 1\rangle =\{1\},$$ $$\langle a\rangle=\langle a^3\rangle=\{1,a,a^2,a^3\},$$ $$\langle a^2\rangle=\{1,a^2\},$$ $$\langle b\rangle=\{1,b\},$$ $$\langle ab\rangle=\{1,ab\},$$ $$\langle a^2b\rangle=\{1,a^2b\},$$ and $$\langle a^3b\rangle=\{1,a^3b\}.$$ Observe that from this, we can conclude that $1$ has order one, $a$ and $a^3$ have order four, and all the other elements of $D_4$ have order two.
Next, we'll want to find all the subgroups generated by two elements of $D_4,$ but if we choose two elements that already share a cyclic subgroup, then we won't get anything new--for example, $\langle a,a^2\rangle=\{1,a,a^2,a^3\}=\langle a\rangle$--so we'll want to choose two elements that don't already share a cyclic subgroup. For example, let's take $a^2$ and $b.$ Now, since $a^2\in\langle a^2,b\rangle$ by definition, then $\langle a^2\rangle\subseteq\langle a^2,b\rangle.$ (Why?) Likewise, $\langle b\rangle\subseteq\langle a^2b\rangle,$ and so $1,a^2,b\in\langle a^2,b\rangle.$ Also, $a^2b$ will be in there (since otherwise, we wouldn't have multiplicative closure). One can show that $ba^2=a^2b,$ and from this, we can show that $\{1,a^2,b,a^2b\}$ is multiplicatively closed, and so is precisely the subgroup of $D_4$ generated by $a^2$ and $b.$ In fact, $$\langle a^2,b\rangle=\langle a^2,a^2b\rangle=\langle b,a^2b\rangle=\{1,a^2,b,a^2b\},$$ and we can similarly find that $$\langle a^2,ab\rangle=\langle a^2,a^3b\rangle=\langle ab,a^3b\rangle=\{1,a^2,ab,a^3b\}.$$ This takes care of all of our proper subgroups. But how can we see this?
The kicker here is to recall that (1) the order of an element must be a factor of the order of any subgroup in which it lies--so for example, any subgroup of $D_4$ with $a$ as an element must have some multiple of $4$ elements in it, so must either have $4$ elements or be the whole group--and (2) that the order of any subgroup must be a factor of the order of the group--meaning that every subgroup's order must be some factor of $8,$ which is the order of $D_4$. Consequently, the only proper subgroup in which $a$ lies is $\langle a\rangle,$ and the same holds for $a^3.$ But to pick two elements of $D_4$ that don't lie in the same cyclic subgroup, at least one of them must be of the form $a^kb$ for some $k\in\{0,1,2,3\}.$ We've already taken care of all cases in which the other chosen element is $a^2,$ and we've seen that the other element can't be $a$ or $a^3$ without generating the whole group, so all that's left is to consider the subgroups of the form $\langle a^jb,a^kb\rangle,$ where $j,k\in\{0,1,2,3\}$ and $j<k.$ But in each case, we can show that $a$ or $a^3$ must lie in the subgroup (so we have the whole group), or that $a^2$ lies in the subgroup (so by the earlier work, we see that there are more than $4$ elements in the subgroup, but the only factor of $8$ greater than $4$ is $8,$ and so we again have the whole group).
In general, we might be able to then go on to find proper subgroups generated by three or more elements, which we'd want to choose so that they didn't all lie in one of the previously-determined subgroups. Fortunately, in this case, we didn't have to do that much work.
