the correct change for a quadratic form matrix is $P^T H P$ with nonsingular $P.$
It is not possible to solve $P^T AP = B$ because $A$ has one positive eigenvalue, one negative and one zero. However, $B$ has two negative eigenvalues and one zero.
Here is diagonal $P^T A P = D_A$
$$
\left(
\begin{array}{rrr}
1 & 0 & 0 \\
-\frac{1}{2} & 1 & 0 \\
1 & -2 & 1
\end{array}
\right)
\left(
\begin{array}{rrr}
2 & 1 & 0 \\
1 & 0 & -1 \\
0 & -1 & -2
\end{array}
\right)
\left(
\begin{array}{rrr}
1 & -\frac{1}{2} & 1 \\
0 & 1 & -2 \\
0 & 0 & 1
\end{array}
\right) =
\left(
\begin{array}{rrr}
2 & 0 & 0 \\
0 & -\frac{1}{2} & 0 \\
0 & 0 & 0
\end{array}
\right)
$$
Here is diagonal $Q^T B Q = D_B$
$$
\left(
\begin{array}{rrr}
1 & 0 & 0 \\
1 & 1 & 0 \\
1 & 1 & 1
\end{array}
\right)
\left(
\begin{array}{rrr}
-1 & 1 & 0 \\
1 & -2 & 1 \\
0 & 1 & -1
\end{array}
\right)
\left(
\begin{array}{rrr}
1 & 1 & 1 \\
0 & 1 & 1 \\
0 & 0 & 1
\end{array}
\right) =
\left(
\begin{array}{rrr}
-1 & 0 & 0 \\
0 & -1 & 0 \\
0 & 0 & 0
\end{array}
\right)
$$
In $D_A$ and $D_B,$ the nonzero diagonal entries are probably not eigenvalues. In the first edition of Horn and Johnson, Matrix Analysis, on page 220, for real symmetric matrices, when $S$ is nonsingular and $B = SAS^T,$ then $A$ and $B$ are called congruent. They do use the word "diagonalize," but they are very careful, in the table on page 229, to have a column for "That which is to be diagonal" with different expression depending on conditions.
Sylvester's_law_of_inertia
It is not necessary to actually find the eigenvalues to confirm this. It is also not necessary to find the characteristic polynomial. The best way to proceed is to solve $P^T AP = D$ diagonal, where I got the diagonal entries as $(2, -1/2,0).$ For $B$ I got $(-1,-1,0).$
reference for linear algebra books that teach reverse Hermite method for symmetric matrices
Addendum: there seems to be some confusion on Sylvester. Here is an example I made up. The original symmetric matrix $C,$ all entries $\pm 1,$ has four positive entries on its diagonal. However, this disagrees with the counts in $D_C,$ which has three positive but one negative entry on the diagonal, and this is what is important for Inertia.
Here is diagonal $R^T C R = D_C$
$$
\left(
\begin{array}{rrrr}
1 & 1 & 1 & 1 \\
-1 & 1 & 0 & 0 \\
-1 & -1 & 2 & 0 \\
-1 & -1 & -1 & 3
\end{array}
\right)
\left(
\begin{array}{rrrr}
1 & -1 & -1 & -1 \\
-1 & 1 & -1 & -1 \\
-1 & -1 & 1 & -1 \\
-1 & -1 & -1 & 1
\end{array}
\right)
\left(
\begin{array}{rrrr}
1 & -1 & -1 & -1 \\
1 & 1 & -1 & -1 \\
1 & 0 & 2 & -1 \\
1 & 0 & 0 & 3
\end{array}
\right) =
\left(
\begin{array}{rrrr}
-8 & 0 & 0 & 0 \\
0 & 4 & 0 & 0 \\
0 & 0 & 12 & 0 \\
0 & 0 & 0 & 24
\end{array}
\right)
$$
Again, the eigenvalues of $C$ are not $-8,4,12,24.$ The eigenvalues of $C$ are $-2,2,2,2.$ In fact, the columns of $R$ are eigenvectors and are perpendicular to each other, it is just that they vary in length, so $R$ is not actually orthogonal. Here is $CR:$
$$
\left(
\begin{array}{rrrr}
1 & -1 & -1 & -1 \\
-1 & 1 & -1 & -1 \\
-1 & -1 & 1 & -1 \\
-1 & -1 & -1 & 1
\end{array}
\right)
\left(
\begin{array}{rrrr}
1 & -1 & -1 & -1 \\
1 & 1 & -1 & -1 \\
1 & 0 & 2 & -1 \\
1 & 0 & 0 & 3
\end{array}
\right) =
\left(
\begin{array}{rrrr}
-2 & -2 & -2 & -2 \\
-2 & 2 & -2 & -2 \\
-2 & 0 & 4 & -2 \\
-2 & 0 & 0 & 6
\end{array}
\right)
$$