Maximization of $f(\theta)=\frac{1}{\sqrt{2\pi c\theta}}e^{-\frac{1}{2c\theta}(x-\theta)^2}$ with inequality constraints I want to maximize the following function:
$$f(\theta)=\frac{1}{\sqrt{2\pi c\theta}}e^{-\frac{1}{2c\theta}(x-\theta)^2}$$
with respect to $\theta\in[0,1]$. Assume the rest of the variables known and $c>0$. Therefore, I took the log:
\begin{eqnarray*}
\mathrm{ln}(f(\theta))&=&\mathrm{ln}(2\pi c\theta)^{-1/2}-\frac{1}{2c\theta}(x-\theta)^2\\
&=&-\frac{1}{2}\mathrm{ln}(2\pi c\theta)-\frac{x^2}{2c\theta}+\frac{x}{c}-\frac{\theta}{2c}
\end{eqnarray*}
and eventually
\begin{eqnarray*}
\frac{\vartheta\mathrm{ln}(f(\theta))}{\vartheta\theta}=0&\Rightarrow&-\frac{1}{2}\frac{2\pi c}{2\pi c\theta}+\frac{x^2}{2c}\frac{1}{\theta^2}-\frac{1}{2c}=0\\
&\Rightarrow&\frac{x^2-c\theta}{c\theta^2}=\frac{1}{c}\\
&\Rightarrow&\theta^2+c\theta-x^2=0
\end{eqnarray*}
Is this a correct approach? What should I do next? I also need to satisfy the constraint $\theta\in[0,1]$.

Hint. What you have done is right. Then solving the quadratic equation gives two potential solutions
$$
\theta_0=-\frac12 \left(\sqrt{c^2+4 x^2}+c\right), \qquad \theta_1=\frac12 \left(\sqrt{c^2+4 x^2}-c\right).
$$ Which $\theta_i$ satisfies $0\le\theta_i \le1$ ? 
