Suppose $f,g:[a,b]\to\mathbb{R}$ are integrable and continuous functions. I want to show that $$\bigg(\int_{a}^{b}f(x)g(x)\,dx\bigg)^2=\int_{a}^{b}f^2(x)\,dx\int_{a}^{b}g^2(x)\,dx $$ if and only if there exists a $k\in\mathbb{R}$ such that $f(x)=kg(x)$.
For the backwards direction, I cannot see why the assumption that $f$ and $g$ is continuous is necessary. I have thought about some step functions where they are not continuous, but I cannot find an example which shows why this is necessary. This direction however, is much more straightforward than the forwards direction.
I believe that the forwards direction is a special case of the elementary Cauchy-Schwarz inequality, where $$\big(\sum_{i=1}^{n}a_ib_i\big)^2=\sum_{i=1}^{n}a_i^2\sum_{i=1}^{n}b_i^2$$ I am just unsure why, again, the hypothesis that $f,g$ be continuous functions is necessary. I think has something to do with the type of partition one can choose, possibly regular partitions are viable for all continuous functions.
Could someone explain $(1)$ why the assumption that $f$ and $g$ are continuous is necessary and/or $(2)$ how I should choose a partition for this proof. I am using the Darboux definition of an integral.