Note that a complex number is algebraic if it is a root of a(nonzero) polynomial with integer coefficients.
a) Sine we need to be root of an integer polynomial, there fore is one of the factors. Clearly is the desired polynomial.
b) Again we need as a root of an integer polynomial. Therefore is one of the factors. Take another factor as (motivation is to get rid of square roots).
Finally we multiply to that to get rid of the final square root.