Prove or disprove that the matrix is invertible Let $P$ be a $n \times n $ matrix with integer entries. Let $q$ be a non integer and $Q = P + qI$ where $I$ is identity matrix.

Prove or disprove that $Q$ is invertible.

This is easy if $P$ is a $2 \times 2$ matrix. In this case it is easy to see that determinant of $Q$ is non zero. Let $P$ be a matrix
\begin{pmatrix}
a & b \\
c & d \\
\end{pmatrix}
then we see that $\det Q = (a + q)(d + q) - bc$. If $q$ is an irrational then the determinant is obviously non zero. If $q$ is a rational then let $q = \frac mn$ where gcd of $m$ and $n$ is $1$. Now it is easy to see that if
$$
(an+m)(dn+m) = n^2 bc
$$
then any prime which divides $n$ doesn't divide $m$ which implies that it doesn't divide LHS as well. So determinant of $Q$ is non zero so we conclude that $Q$ is invertible.
Now how to prove for higher dimension matrices?
 A: You basically want to know whether $-q$ is an eigenvalue of $P$. This is true if and only if $k_P(-q) = 0$, where $k_P(x) = \det(x I-P)$ is the characteristic polynomial of $P$. Since $P$ has integer coefficients, we have $k_P \in \Bbb{Z}[x]$ and it is a monic polynomial with $\deg k_P = n$ so clearly if $q$ not an algebraic integer or is an algebraic integer of degree $> n$ then $-q$ cannot be a zero of $k_P$ so $P+qI$ is invertible.
On the other hand, if $q$ is algebraic of degree $\le n$, then let $p(t) = c_0 + c_1 t + \cdots + c_{k-1}t_{k-1} + t^k \in \Bbb{Z}[x]$ be the minimal polynomial of $-q$ with $k \le n$. You can check that the $n \times n$ matrix
$$P = \begin{bmatrix}0 & 0 & \cdots & 0 & -c_0 & 0 & 0 & \cdots & 0\\ 1 & 0 & \cdots & 0 & -c_1 & 0 & 0 & \cdots & 0\\ 0 & 1 & \cdots & 0 & -c_2 & 0 & 0 & \cdots & 0\\ \vdots & \vdots & \ddots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots \\  0 & 0 & \cdots & 1 & -c_{k-1}  & 0 & 0 & \cdots & 0 \\ 0 & 0 & \cdots & 0 & 0 & 1 & 0 & \cdots & 0\\ 0 & 0 & \cdots & 0 & 0 & 0 & 1 & \cdots & 0\\  \vdots & \vdots & \ddots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots\\
0 & 0 & \cdots & 0 & 0 & 0 & 0 & \cdots & 1 \end{bmatrix}$$
has $k_P(x) = p(x)(x-1)^{n-k}$ so $k_P(-q)=0$ and therefore $P+qI$ is not invertible.
For your $2 \times 2$ example, your analysis is wrong, for example $\sqrt{2}$ is an algebraic integer with minimal polynomial $x^2-2$ so for $$P = \begin{bmatrix} 0 & 2 \\ 1 & 0 \end{bmatrix}$$
we have that $P+\sqrt{2} I$ is not invertible. Also for any $P$ and $q = \frac12$ (which is not an algebraic integer), we have
$$\det \left(P+\frac12 I\right) = \left(a+\frac12\right)\left(d+\frac12\right) - bc \in \Bbb{Z}+\frac14$$
so it is nonzero and hence $P+\frac12 I$ is invertible. Similarly, for any $P$ and $q = \sqrt[3]{2}$ which is an algebraic integer of degree $3$, you can check that $P+\sqrt[3]{2} I$ is invertible.
