How can one do dimensional analysis when units are not known? In the sciences, we can do dimensional analysis and unit checks to verify whether or not the LHS and the RHS have the same units. If we have the following function:$$y=f(x)=x^{2}$$
  what ensures the preserving of units? I have a feeling it is the exponent of 2 which is not dimensionless, but if we write it as:$$y=x^{2}=x\times x$$
  where can I see balancing out of the dimensions?

If you're doing mathematics, usually you work with dimensionless quantities, so it makes no sense to try to do dimensional analysis.
