I am trying to reduce the quadratic form

$$q(x_1, x_2, x_3, x_4) = x_1x_2 + x_1x_3 + x_1x_4 + x_2x_4$$

into a quadratic form of the form

$$q = \lambda_1 y_1^2 + \lambda_2 y_2^2 + \cdots + \lambda_r y_r^2$$

for some real numbers $$\lambda_1, \lambda_2, \dots, \lambda_r$$, where $$1 \leq r \leq 4$$.

I first attempted to do this by completing the square and the best I got was

$$q = -y_1^2+y_2^2 - \frac{1}{4}y_3^2 -x_3x_4$$

where

$$y_1 = x_1, \qquad y_2 = x_1 + \frac{1}{2}x_2 + \frac{1}{2}x_3 + \frac{1}{2}x_4, \qquad y_3 = x_2+x_3-x_4$$

I couldn't simplify the quadratic form any further. I then tried it by orthogonally diagonalizing the matrix $$A$$ associated with the quadratic form. However the values for my eigenvalues were seemingly not rational suggesting that this is perhaps not the best method (I'm expected to find rational values for the coefficients $$\lambda_i$$. I'm not exactly sure where I've gone wrong here since I've checked both my methods several times now.

That looks like $$\frac{y_1^2-y_2^2+y_3^3-y_4^2}4$$ where $$y_1=x_1+x_2+x_3+x_4,$$ $$y_2=x_1-x_2-x_3-x_4,$$ $$y_3=x_2+x_4$$ and $$y_4=x_2-x_4.$$

You have already a fine answer. If completing the square is not easy for you, there is an algorithm for exactly this purpose. In the matrix answer repeated just below, note that your quadratic form is doubled ($$H$$ is the Hessian matrix) and writing it out gives something very similar to the answer you accepted.

$$\frac{y_1^2-y_2^2-y_3^2+y_4^2}4$$ $$y_1=x_1+x_2+x_3+2x_4,$$ $$y_2=-x_1+x_2+x_3,$$ $$y_3=x_3+2x_4,$$ $$y_4=x_3.$$

$$Q^T D Q = H$$ $$\left( \begin{array}{rrrr} \frac{ 1 }{ 2 } & - 1 & 0 & 0 \\ \frac{ 1 }{ 2 } & 1 & 0 & 0 \\ \frac{ 1 }{ 2 } & 1 & \frac{ 1 }{ 2 } & 1 \\ 1 & 0 & 1 & 0 \\ \end{array} \right) \left( \begin{array}{rrrr} 2 & 0 & 0 & 0 \\ 0 & - \frac{ 1 }{ 2 } & 0 & 0 \\ 0 & 0 & - 2 & 0 \\ 0 & 0 & 0 & \frac{ 1 }{ 2 } \\ \end{array} \right) \left( \begin{array}{rrrr} \frac{ 1 }{ 2 } & \frac{ 1 }{ 2 } & \frac{ 1 }{ 2 } & 1 \\ - 1 & 1 & 1 & 0 \\ 0 & 0 & \frac{ 1 }{ 2 } & 1 \\ 0 & 0 & 1 & 0 \\ \end{array} \right) = \left( \begin{array}{rrrr} 0 & 1 & 1 & 1 \\ 1 & 0 & 0 & 1 \\ 1 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 \\ \end{array} \right)$$

Algorithm discussed at http://math.stackexchange.com/questions/1388421/reference-for-linear-algebra-books-that-teach-reverse-hermite-method-for-symmetr
https://en.wikipedia.org/wiki/Sylvester%27s_law_of_inertia
$$H = \left( \begin{array}{rrrr} 0 & 1 & 1 & 1 \\ 1 & 0 & 0 & 1 \\ 1 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 \\ \end{array} \right)$$ $$D_0 = H$$ $$E_j^T D_{j-1} E_j = D_j$$ $$P_{j-1} E_j = P_j$$ $$E_j^{-1} Q_{j-1} = Q_j$$ $$P_j Q_j = Q_j P_j = I$$ $$P_j^T H P_j = D_j$$ $$Q_j^T D_j Q_j = H$$

$$H = \left( \begin{array}{rrrr} 0 & 1 & 1 & 1 \\ 1 & 0 & 0 & 1 \\ 1 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 \\ \end{array} \right)$$

==============================================

$$E_{1} = \left( \begin{array}{rrrr} 1 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right)$$ $$P_{1} = \left( \begin{array}{rrrr} 1 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) , \; \; \; Q_{1} = \left( \begin{array}{rrrr} 1 & 0 & 0 & 0 \\ - 1 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) , \; \; \; D_{1} = \left( \begin{array}{rrrr} 2 & 1 & 1 & 2 \\ 1 & 0 & 0 & 1 \\ 1 & 0 & 0 & 0 \\ 2 & 1 & 0 & 0 \\ \end{array} \right)$$

==============================================

$$E_{2} = \left( \begin{array}{rrrr} 1 & - \frac{ 1 }{ 2 } & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right)$$ $$P_{2} = \left( \begin{array}{rrrr} 1 & - \frac{ 1 }{ 2 } & 0 & 0 \\ 1 & \frac{ 1 }{ 2 } & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) , \; \; \; Q_{2} = \left( \begin{array}{rrrr} \frac{ 1 }{ 2 } & \frac{ 1 }{ 2 } & 0 & 0 \\ - 1 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) , \; \; \; D_{2} = \left( \begin{array}{rrrr} 2 & 0 & 1 & 2 \\ 0 & - \frac{ 1 }{ 2 } & - \frac{ 1 }{ 2 } & 0 \\ 1 & - \frac{ 1 }{ 2 } & 0 & 0 \\ 2 & 0 & 0 & 0 \\ \end{array} \right)$$

==============================================

$$E_{3} = \left( \begin{array}{rrrr} 1 & 0 & - \frac{ 1 }{ 2 } & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right)$$ $$P_{3} = \left( \begin{array}{rrrr} 1 & - \frac{ 1 }{ 2 } & - \frac{ 1 }{ 2 } & 0 \\ 1 & \frac{ 1 }{ 2 } & - \frac{ 1 }{ 2 } & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) , \; \; \; Q_{3} = \left( \begin{array}{rrrr} \frac{ 1 }{ 2 } & \frac{ 1 }{ 2 } & \frac{ 1 }{ 2 } & 0 \\ - 1 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) , \; \; \; D_{3} = \left( \begin{array}{rrrr} 2 & 0 & 0 & 2 \\ 0 & - \frac{ 1 }{ 2 } & - \frac{ 1 }{ 2 } & 0 \\ 0 & - \frac{ 1 }{ 2 } & - \frac{ 1 }{ 2 } & - 1 \\ 2 & 0 & - 1 & 0 \\ \end{array} \right)$$

==============================================

$$E_{4} = \left( \begin{array}{rrrr} 1 & 0 & 0 & - 1 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right)$$ $$P_{4} = \left( \begin{array}{rrrr} 1 & - \frac{ 1 }{ 2 } & - \frac{ 1 }{ 2 } & - 1 \\ 1 & \frac{ 1 }{ 2 } & - \frac{ 1 }{ 2 } & - 1 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) , \; \; \; Q_{4} = \left( \begin{array}{rrrr} \frac{ 1 }{ 2 } & \frac{ 1 }{ 2 } & \frac{ 1 }{ 2 } & 1 \\ - 1 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) , \; \; \; D_{4} = \left( \begin{array}{rrrr} 2 & 0 & 0 & 0 \\ 0 & - \frac{ 1 }{ 2 } & - \frac{ 1 }{ 2 } & 0 \\ 0 & - \frac{ 1 }{ 2 } & - \frac{ 1 }{ 2 } & - 1 \\ 0 & 0 & - 1 & - 2 \\ \end{array} \right)$$

==============================================

$$E_{5} = \left( \begin{array}{rrrr} 1 & 0 & 0 & 0 \\ 0 & 1 & - 1 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right)$$ $$P_{5} = \left( \begin{array}{rrrr} 1 & - \frac{ 1 }{ 2 } & 0 & - 1 \\ 1 & \frac{ 1 }{ 2 } & - 1 & - 1 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) , \; \; \; Q_{5} = \left( \begin{array}{rrrr} \frac{ 1 }{ 2 } & \frac{ 1 }{ 2 } & \frac{ 1 }{ 2 } & 1 \\ - 1 & 1 & 1 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) , \; \; \; D_{5} = \left( \begin{array}{rrrr} 2 & 0 & 0 & 0 \\ 0 & - \frac{ 1 }{ 2 } & 0 & 0 \\ 0 & 0 & 0 & - 1 \\ 0 & 0 & - 1 & - 2 \\ \end{array} \right)$$

==============================================

$$E_{6} = \left( \begin{array}{rrrr} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ \end{array} \right)$$ $$P_{6} = \left( \begin{array}{rrrr} 1 & - \frac{ 1 }{ 2 } & - 1 & 0 \\ 1 & \frac{ 1 }{ 2 } & - 1 & - 1 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ \end{array} \right) , \; \; \; Q_{6} = \left( \begin{array}{rrrr} \frac{ 1 }{ 2 } & \frac{ 1 }{ 2 } & \frac{ 1 }{ 2 } & 1 \\ - 1 & 1 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ \end{array} \right) , \; \; \; D_{6} = \left( \begin{array}{rrrr} 2 & 0 & 0 & 0 \\ 0 & - \frac{ 1 }{ 2 } & 0 & 0 \\ 0 & 0 & - 2 & - 1 \\ 0 & 0 & - 1 & 0 \\ \end{array} \right)$$

==============================================

$$E_{7} = \left( \begin{array}{rrrr} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & - \frac{ 1 }{ 2 } \\ 0 & 0 & 0 & 1 \\ \end{array} \right)$$ $$P_{7} = \left( \begin{array}{rrrr} 1 & - \frac{ 1 }{ 2 } & - 1 & \frac{ 1 }{ 2 } \\ 1 & \frac{ 1 }{ 2 } & - 1 & - \frac{ 1 }{ 2 } \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & - \frac{ 1 }{ 2 } \\ \end{array} \right) , \; \; \; Q_{7} = \left( \begin{array}{rrrr} \frac{ 1 }{ 2 } & \frac{ 1 }{ 2 } & \frac{ 1 }{ 2 } & 1 \\ - 1 & 1 & 1 & 0 \\ 0 & 0 & \frac{ 1 }{ 2 } & 1 \\ 0 & 0 & 1 & 0 \\ \end{array} \right) , \; \; \; D_{7} = \left( \begin{array}{rrrr} 2 & 0 & 0 & 0 \\ 0 & - \frac{ 1 }{ 2 } & 0 & 0 \\ 0 & 0 & - 2 & 0 \\ 0 & 0 & 0 & \frac{ 1 }{ 2 } \\ \end{array} \right)$$

==============================================

$$P^T H P = D$$ $$\left( \begin{array}{rrrr} 1 & 1 & 0 & 0 \\ - \frac{ 1 }{ 2 } & \frac{ 1 }{ 2 } & 0 & 0 \\ - 1 & - 1 & 0 & 1 \\ \frac{ 1 }{ 2 } & - \frac{ 1 }{ 2 } & 1 & - \frac{ 1 }{ 2 } \\ \end{array} \right) \left( \begin{array}{rrrr} 0 & 1 & 1 & 1 \\ 1 & 0 & 0 & 1 \\ 1 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 \\ \end{array} \right) \left( \begin{array}{rrrr} 1 & - \frac{ 1 }{ 2 } & - 1 & \frac{ 1 }{ 2 } \\ 1 & \frac{ 1 }{ 2 } & - 1 & - \frac{ 1 }{ 2 } \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & - \frac{ 1 }{ 2 } \\ \end{array} \right) = \left( \begin{array}{rrrr} 2 & 0 & 0 & 0 \\ 0 & - \frac{ 1 }{ 2 } & 0 & 0 \\ 0 & 0 & - 2 & 0 \\ 0 & 0 & 0 & \frac{ 1 }{ 2 } \\ \end{array} \right)$$ $$Q^T D Q = H$$ $$\left( \begin{array}{rrrr} \frac{ 1 }{ 2 } & - 1 & 0 & 0 \\ \frac{ 1 }{ 2 } & 1 & 0 & 0 \\ \frac{ 1 }{ 2 } & 1 & \frac{ 1 }{ 2 } & 1 \\ 1 & 0 & 1 & 0 \\ \end{array} \right) \left( \begin{array}{rrrr} 2 & 0 & 0 & 0 \\ 0 & - \frac{ 1 }{ 2 } & 0 & 0 \\ 0 & 0 & - 2 & 0 \\ 0 & 0 & 0 & \frac{ 1 }{ 2 } \\ \end{array} \right) \left( \begin{array}{rrrr} \frac{ 1 }{ 2 } & \frac{ 1 }{ 2 } & \frac{ 1 }{ 2 } & 1 \\ - 1 & 1 & 1 & 0 \\ 0 & 0 & \frac{ 1 }{ 2 } & 1 \\ 0 & 0 & 1 & 0 \\ \end{array} \right) = \left( \begin{array}{rrrr} 0 & 1 & 1 & 1 \\ 1 & 0 & 0 & 1 \\ 1 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 \\ \end{array} \right)$$