Step 1: Find the rank of matrix \(A\).
Given
\[
A=
\begin{bmatrix}
1 & 0 & 1\\
2 & 1 & 2\\
1 & 0 & -1
\end{bmatrix}
\]
To find the rank of \(A\), first calculate its determinant.
\[
|A|=
\begin{vmatrix}
1 & 0 & 1\\
2 & 1 & 2\\
1 & 0 & -1
\end{vmatrix}
\]
Expanding along the first row,
\[
|A|=1
\begin{vmatrix}
1 & 2\\
0 & -1
\end{vmatrix}
+
1
\begin{vmatrix}
2 & 1\\
1 & 0
\end{vmatrix}
\]
Now,
\[
\begin{vmatrix}
1 & 2\\
0 & -1
\end{vmatrix}
=1(-1)-2(0)=-1
\]
Also,
\[
\begin{vmatrix}
2 & 1\\
1 & 0
\end{vmatrix}
=2(0)-1(1)=-1
\]
Therefore,
\[
|A|=-1-1=-2
\]
Since
\[
|A|\neq 0,
\]
the matrix \(A\) is non-singular.
Hence,
\[
r_1=3
\]
Step 2: Find the rank of matrix \(B\).
Given
\[
B=
\begin{bmatrix}
1 & 2 & 3 & 4\\
2 & 4 & 6 & -8
\end{bmatrix}
\]
This is a \(2\times 4\) matrix, so its maximum possible rank is \(2\).
Now compare the two rows:
\[
R_1=[1\ 2\ 3\ 4]
\]
and
\[
R_2=[2\ 4\ 6\ -8]
\]
If \(R_2\) were a multiple of \(R_1\), then multiplying \(R_1\) by \(2\) would give
\[
2R_1=[2\ 4\ 6\ 8]
\]
But
\[
R_2=[2\ 4\ 6\ -8]
\]
Since the last element is different,
\[
R_2\neq 2R_1
\]
Therefore, the two rows are linearly independent.
Hence,
\[
r_2=2
\]
Step 3: Calculate \(r_1-r_2\).
We have
\[
r_1=3
\]
and
\[
r_2=2
\]
Therefore,
\[
r_1-r_2=3-2
\]
So,
\[
r_1-r_2=1
\]
Step 4: Final conclusion.
Hence,
\[
\boxed{1}
\]