Discriminant of $\mathbb{Q}(\sqrt{d})\big/\mathbb{Q}$ for square-free $d$. Claim: The discriminant of $\mathbb{Q}(\sqrt{d})\big/\mathbb{Q}$ is equal to 
$$\begin{align*} d,&\quad\text{if } d\equiv 1\text{ mod }4\\
 4d,&\quad\text{if } d\not\equiv 1\text{ mod }4
\end{align*}$$
What I have done so far:
$\mathbb{Q}(\sqrt{d})\big/\mathbb{Q}$ has the $\mathbb{Q}$-basis $(1,\sqrt{d})=:(e_1,e_2)$. The discriminant of $\mathbb{Q}(\sqrt{d})$ is defined by
$$disc_{\mathbb{Q}}(1,\sqrt{d}):=det(Tr_{\mathbb{Q}(\sqrt{d})\big/\mathbb{Q}}(e_i\cdot e_j))$$
Calculating $e_i\cdot e_j$ gives $e_1\cdot e_1= 1$, $e_1\cdot e_2=e_2\cdot e_1=\sqrt{d}$, $e_2\cdot e_2= d$.
Let $x\in \mathbb{Q}(\sqrt{d})$ and define
$$m_x:\mathbb{Q}(\sqrt{d})\longrightarrow \mathbb{Q}(\sqrt{d}),\quad q\longmapsto xq.$$
Calculating the representing matrizes $[m_x]$ for $x\in\{1,\sqrt{d},d\}$ gives
$$(1,\sqrt{d})=(1,\sqrt{d})\begin{pmatrix}
1 & 0\\
0 & 1
\end{pmatrix}\Rightarrow [m_1]=\begin{pmatrix}
1 & 0\\
0 & 1
\end{pmatrix}\Rightarrow Tr_{\mathbb{Q}(1)\big/\mathbb{Q}}(1)=2,$$
$$(\sqrt{d},d)=(1,\sqrt{d})\begin{pmatrix}
0 & d\\
1 & 0
\end{pmatrix}\Rightarrow [m_\sqrt{d}]=\begin{pmatrix}
0 & d\\
1 & 0
\end{pmatrix}\Rightarrow Tr_{\mathbb{Q}(\sqrt{d})\big/\mathbb{Q}}(\sqrt{d})=0,$$
$$(d,d\sqrt{d})=(1,\sqrt{d})\begin{pmatrix}
d & 0\\
0 & d
\end{pmatrix}\Rightarrow [m_d]=\begin{pmatrix}
d & 0\\
0 & d
\end{pmatrix}\Rightarrow Tr_{\mathbb{Q}(\sqrt{d})\big/\mathbb{Q}}(d)=2d.$$
Now one can calculate the discriminant
$$disc_{\mathbb{Q}}(1,\sqrt{d})=det(Tr_{\mathbb{Q}(\sqrt{d})\big/\mathbb{Q}}(e_i\cdot e_j))=det(\begin{pmatrix}
2 & 0\\
0 & 2d
\end{pmatrix})=4d.$$
Questions:
Now if $d\equiv 1\text{ mod }4$, it holds $4d\equiv 0\text{ mod }4$? Even if $d\not\equiv 1\text{ mod }4$, doesn't there follow $4d\equiv 0\text{ mod }4$ as well?  Why is the discriminant equal to $d$ or $4d$? 
 A: The discriminant of a number field extension is defined as the discriminant of the ring of integers with respect to the integral basis. This number is always same regardless of which integral basis you use. On the other side the discriminant of a basis of $\mathbb{Q}(\sqrt d)$ or in general of any extension depends on the basis.
So in your case you need to prove that the ring of integers of $\mathbb{Q}(\sqrt{d})$ is:
$$\begin{align*} \mathbb{Z}[\sqrt{d}],&\quad\text{if } d \not\equiv 1\text{ mod }4\\
 \mathbb{Z}\left[\frac{1+\sqrt{d}}{2}\right],&\quad\text{if } d\equiv 1\text{ mod }4
\end{align*}$$
To prove this let $\alpha \in O_k \subset \mathbb{Q}(\sqrt{d})$, the ring of integers. Then we have that $\alpha = \frac{a+b\sqrt{d}}{c}$ and we might assume that $\gcd(a,b,c)=1$. Then it's minimal polynomial is $x^2 - \frac{2a}{c}x + \frac{a^2 - db^2}{c^2} \in \mathbb{Z}[x]$
If $\gcd(a,b) = m$, then the free coefficient gives us that $m \mid b$, as $d$ can be assumed to be squarefree, which is impossible. So $m=1$ and $c\mid 2$, so we consider two cases $c=1,2$. $c=1$ will yield the elements of $\mathbb{Z}[\sqrt{d}]$, so we need to check when $c=2$ is possible. If this is the case then we have that $4 \mid a^2 - db^2$ and so $m$ is a quadratic residue modulo $4$ and as it's squarefree we must have $d \equiv 1 \pmod 4$.
This gives us that an integral basis $\mathbb{Q}$ is:
$$\begin{align*} \{1,\sqrt d\},&\quad\text{if }d \not\equiv 1\text{ mod }4\\
 \left \{1, \frac{1+\sqrt{d}}{2}\right \},&\quad\text{if } d\equiv 1\text{ mod }4
\end{align*}$$
Now you should be able to compute the discriminant in each case.
