# How to generate data such that an equation needs to hold?

Can I create or generate $$\{y_i\}_{i=1}^{4}$$ data set such that this equation holds

$$\sum_{i=1}^{4}\sum_{j=1}^{4}m_{ij}y_{i}y_{j}=6$$ where $$m=\left[ \begin{array}{cccc} 13 & 12 & 3 & 5 \\ 12 & 1 & 1 & 2 \\ 3 & 1 & 43 & 3 \\ 5 & 2 & 3 & 21% \end{array}% \right]$$

If I can do this, can you please tell me how to do it? or give me a reference.

Thank you so much in advance

• If $\mathbf{M}$ was positive definite, the equality $\mathbf{y}^T\mathbf{M}\mathbf{y}=6$ would imply that $\mathbf{y}$ lies on a hyperellipsoid. But $\mathbf{y}$ appear to have one negative eigenvalue. – Jarle Tufto Nov 8 at 15:03
• @JarleTufto so if M was positive definite, I can do this? Are you aware of a function or something in matlab, python or R that does this job? Thank you! – rsc05 Nov 8 at 15:07
• With $\mathbf{M}$ being symmetric with one negative eigenvalue $\mathbf{y}^T\mathbf{M}\mathbf{y}$ describes a saddle-shaped hypersurface and $\mathbf{y}$ lies on a level curve of this hypersurface. I'm sure some simple linear-algebra trick can be made to generate points on this set. – Jarle Tufto Nov 8 at 15:12
• en.wikipedia.org/wiki/Hyperboloid may be relevant. – Jarle Tufto Nov 8 at 15:24

Since you only have one equation and 4 unknowns ($$y_i, i=1, 2...4$$), the system is undetermined. How about the following method?
Randomly pick $$y_i, i=1, 2...3$$ from some distribution, then solve numerically for $$y_4$$