# extracting the coefficients of a linear combination

Let me just say that I'm quite new to sage (although I'm making a progress!)

I wish to input a number field (in my case real quadratic field), a basis $w_1,w_2$ over $ \mathbb Q$ and an element $v$ of this number field and get the coefficient of $v$ as a linear combination of $w_1$ and $w_2$. I.e., if $v=aw_1+bw_2$ I wish to get (a,b).

I tried doing this with just solving equations in matrices but I didn't find a way to make it solve the equations over the base field $ \mathbb Q$.

Thanks a lot for helping! Menny