I want to find the order of the subgroup $\langle ab\rangle$ of $D_3=\langle a,b\mid a^3=1,b^2=1,ba=a^2b\rangle$
According to my notes, the order of this subgroup is 3. But why is it like that?
I thought that it would be 2,because :
$$(ab)^1=ab$$ $$(ab)^2=(ab)(ab)=a(ba)b=aa^2bb=a^3b^2=1$$
Isn't it like that?
EDIT: The diagram of the subgroups of $D_3$ that is in my notes is:

But, is the right one maybe like that?

As has been discussed in the comments, the subgroup $\langle ab\rangle < D_3$ has order two (as you correctly demonstrated) and has index three. Furthermore, your second diagram is correct; it is the subgroup lattice for $D_3$ where the red numbers indicate the order of each subgroup in the corresponding row.