Show that $g\in L^q(E)$ and $\|g\|_q\leq M.$ 
Question: Let $E$ be a measurable subset of real numbers and $1<p<\infty.$
      Let $q$ be the conjugate of $p.$
      Suppose that a function $g$ is integrable over $E$ and there is an $M \geq 0$ such that for each simple function $f \in L^p(E),$
      $$\left| \int_E g \cdot f \right| \leq M \|f\|_p.$$
      Prove that $g \in L^q(E)$ and $\|g\|_q \leq M.$

For this question, I do not know how to relate the integral $\int_E |g|^q$ to $\left| \int_E g\cdot f \right|.$
I tried Holder 
$$\int_E |g|^q \leq \left(\int_E |g|\right)^q \left( \int_E 1^\frac{1}{p} \right)^p = \left(\int_E |g|\right)^q (m(E))^p$$
but the inequality does not seem to help. 
 A: For a given $g\in L(E)$ define the linear functional
$$L_g(f):=\int_Egf$$
Then we have
$$|L_g(f)|\leqslant \int_E |gf|\leqslant \Big(\int_E g^q\Big)^{1/q}\Big(\int_E |f|^p\Big)^{1/p}=||g||_q\cdot ||f||_p$$
If $g\in L^q(E)$ then this is simply Holder's inequality since also $f\in L^p(E)$, if $||g||_q=+\infty$ the inequality holds trivially.  On the other hand by assumption we have
$$|L_g(f)|\leqslant M||f||_p$$
for all $f\in S\cap L(E)$ where $S$ is the set of all simple functions. Now by definition of the operator norm we obtain 
$$\sup_{f\in S\cap L(E) }\frac{|L_g(f)|}{||f||_p}:=||L_g||$$
From the Holder's inequality above it must be the case that 
$$||L_g||\leqslant||g||_q$$
The other direction is more involved but you can pick $0< \varepsilon< ||g||_q$ such that $$|L_g(f)|\geqslant (||g||_q-\varepsilon)||f||_p\hspace{0.2cm}\text{(One needs to work this out)}$$
Letting $\varepsilon\to 0$ then $||L_g||\geqslant ||g||_q$. All in all we have get $||L_g||=||g||_q$. On the other hand the inequality $|L_g(f)|\leqslant M||f||_p$ implies
$$||L_g||\leqslant M$$
Since by definition of operator norm we must have $||g||_q$ is the least upper bound then it must be the case that $||g||_q\leqslant M<+\infty$. Of course this implies that $g\in L^q(E)$.
A: Let $(\phi_n)$ be a sequence of simple functions on $E$ s.t. $\phi_n\to g$ pointwise on $E$ and $|\phi_n|\leq|g|$. I suppose you already know why such a sequence exists.
Since $supp(\phi_n)$ is of finite measure, $(\phi_n)\subset L^r(E)$ for all $r$. Now Consider the functions $$f_n=\frac{|\phi_n|^{q-1}\overline{sgn(g)}}{\|\phi_n\|_q^{q-1}}$$ and notice that they are simple functions and that $\|f_n\|_p=1$. hence for all $n$ it is $$|\int_Eg\cdot f_nd\mu|\leq M$$ 
Also notice that $$|\phi_n\cdot f_n|=\frac{|\phi_n|^q}{\|\phi_n\|_q^{q-1}}$$ hence 
$\int_E|\phi_n f_n|d\mu=\|\phi_n\|_q$
Now it is $\displaystyle{\|g\|_q}=\bigg{(}\int_E|g|^qd\mu\bigg{)}^{1/q}\leq\liminf_{n\to\infty}\bigg{(}\int_E|\phi_n|^qd\mu\bigg{)}^{1/q}=\liminf\int_E|\phi_nf_n|d\mu\leq$
$\displaystyle{\leq\liminf\int_E|gf_n|d\mu=\liminf\int_Egf_nd\mu=|\int_Egf_nd\mu|\leq M}$
and that does it. In the last inequalities/equalities, we used the fact that $gf_n$ are positive. The liminf's appeared using Fatou's lemma. Also the exponent $1/q$ is not a problem by the continuity of $x\mapsto x^{1/q}$ and the fact that it is increasing.
