If $x^*$ is an optimal solution of $P$, then it is an optimal solution of the problem $Q$ Let $P$ be the problem
\begin{alignat}{2}
&\text{min} \ \  && f(\mathbf{x})\\
&s.t && g(x) \leq 0\\
& &&x\in X
\end{alignat}
for convex functions $f$ and $g$ over $\mathbb{R}^n$ and $X\subseteq\mathbb{R}^n$ is a convex set. Then if $\mathbf{x}^*$ is an optimal solution to $P$ with $g(x)<0$, then $\mathbf{x}^*$ is also an optimal solution to the problem $Q$:
\begin{alignat}{2}
&\text{min} \ \  && f(\mathbf{x})\\
& &&x\in X.
\end{alignat}
I'm having trouble seeing how exactly $x^*$ would be an optimal solution to $Q$. Is there a way to exploit $g$ and its convexity to show this?
Thanks
 A: Let $h_P(x) = f(x)$ over $g(x) \le 0$ and $x \in X$ and prolongate it with $+\infty$ otherwise, and $h_Q(x)=f(x)$ over $x \in X$. Then $P$ and $Q$ can be rewritten as $$\min_{x \in \mathbb{R}} h_P(x)$$ 
and 
$$\min_{x \in \mathbb{R}} h_Q(x).$$
By optimality condition on convex problems using subgradients, we know that $x^*$ is an optimal solution of $P$ iff the subgradient of $h_P$ at $x^*$ contains $0$.
The set $\{x \in X,g(x)<0\}$ is open in $X$ since $g$ is continuous. See here  for details.
If $x^*$ satifies $g(x^*) <0$, either $x^*$ lies in the interior of $X$ and $h_P=h_Q$ on an open set around $x^*$ and the subgradient of $h_P$ at $x^*$ is the same as the subgradient of $h_Q$. Or $x^*$ lies in the boundary of $X$ and $h_P=f=h_Q$ also around it since $g$ does not interfere, and we can make the same conclusion on subgradients.
Since $x^*$ is an optimal solution to $P$, the subgradient of $h_P$ at $x^*$ contains $0$. Hence, the subgradient of $h_Q$ at $x^*$ also contains $0$ and by optimality condition aforementionned, $x^*$ is a solution to $Q$.
