Question 21If x is a real number such that $x^3+\frac 1{x^3}=18$, determine the value of $\left(x+\frac 1 x\right)^2$.