You only have two conditions for p(x), so , where s and t are arbitrary real parameters. The solution formulae and can't be correct, since for example this would mean p(0) = t and q(0) = t. Perhaps there is a typo somewhere.