<s>[INST] Find the roots of the equation $x^2-[x]=4$ where $[x]$ is the greatest integer less than or equal to $x$. Show that there is no rational number $x$ satisfying the equation $x^2-[x]=4$. Find the roots of the equation $x^2-[x]=4$ where $[x]$ is the greatest integer less than or equal to $x$.
I tried to solve this equation but stuck.
For the first part i supposed $x=\frac{p}{q}$ be the solution of the equation.
$$\frac{p^2}{q^2}-4=\left[\frac{p}{q}\right]$$
Now LHS is rational and RHS is an integer. Therefore our assumption is wrong. There is contradiction. So its roots are not rational.
$x^2-4=[x]\implies (x-2)(x+2)=[x]$
How should i move ahead? Please guide me. Its roots are $-\sqrt2,\sqrt6$.
Is my method of solving the first part correct?
 [/INST] Write $x = [x] + \varepsilon$. Then you are trying to solve
$$n^2 + 2\varepsilon n + \varepsilon^2 - n - 4= 0 $$
For an integer value of $n$ and some $\varepsilon \in [0,1)$.  By the quadratic formula we can express $\varepsilon$ in terms of $n$,
$$\varepsilon^2 + (2n)\varepsilon +[n^2  - n - 4]= 0 $$
$$\varepsilon = \frac{-2n ± \sqrt{4n^2 - 4(n^2 - n - 4)}}{2} = -n ± \sqrt{n+4}$$
So now we want to find values of $n$ where
$$ -n + \sqrt{n+4} \in [0,1)$$
or $$-n -\sqrt{n+4} \in [0,1)$$
Lets try the first case, i.e. find $n$ such that
$-n + \sqrt{n+4} \in [0,1) $.
Both conditions below must hold for a solution:
$$ -n + \sqrt{n+4} \geq 0 \quad\text{ and } -n + \sqrt{n+4} < 1\quad$$
We try small values of $n\geq -4$,
$$\begin{array}{c|cccc}
n & -4 & -3 & -2 & -1 & 0 & 1 & 2 & 3\\ \hline
-n+\sqrt{n+4} & 4 & 4 & 2+\sqrt{2} & 1+\sqrt{3} & 2 & -1+\sqrt{5} & \color{red}{-2+\sqrt{6}} & -3+\sqrt{7}
\end{array}$$
There is no need to check $n<-4$ since $\sqrt{n+4}$ won't be defined, and no need to check $n>3$ since the gap only widens. ($-n + \sqrt{n+4}$ is decreasing for $n>3$).
so $n=2$ is the only solution for the first case, with $\varepsilon=-2+\sqrt{6}$ and $x=\sqrt{6}$.
Similarly for the second case, we need
$$ -n - \sqrt{n+4} \geq 0 \quad\text{ and } -n - \sqrt{n+4} < 1\quad$$
$$\begin{array}{c|cccccc}
n & -4 & -3 & -2 & -1 & 0 \\ \hline
-n-\sqrt{n+4} & 4 & 2 & \color{red}{2-\sqrt{2}} & 1-\sqrt{3}& -2 \\
\end{array}$$
There is no need to check $n\le-4$ or $n>0$, for similar reasons to the first case. Hence, the only two solutions to the whole problem are
$$ x=-\sqrt{2},\sqrt{6}.$$

Regarding the rest of the question as in your edit:
Your proof is incomplete. An integer is also rational! If $p/q$ is a solution, then we do indeed get $\frac{p^2}{q^2} - 4 = \left[\frac{p}{q}\right]$, but this itself is not a contradiction. It only means that $q^2=1$. Thus the equation reduces to
$$p^2 - p - 4 = 0, \quad p\in\Bbb Z$$
But of course the only real solutions to this are $\frac{1± \sqrt{1+16}}{2}$ which are not integers.
</s>