<s>[INST] Distance between $\left\{(x,y,z):\frac{x^2}{a^2}+\frac{y^2}{b^2}+\frac{z^2}{c^2}=1\right\}$ and $\big\{(x,y,z): x+y+z=h\big\}$ Calculate the distance between $$M=\left\{(x,y,z) \in \mathbb{R}^{3}: \frac{x^2}{a^2}+ \frac{y^2}{b^2}+\frac{z^2}{c^2}=1\right\}$$ and $$H=\big\{(x,y,z) \in \mathbb{R}^{3}: x+y+z=h\big\}$$ where $a,b,c,h \in \mathbb{R}^+$.
 [/INST] I'm assuming when you say the distance between $M$ and $H$ you mean $Dist(M, H) = \inf\{||x-y|| \ |\ x\in M, y\in H\}$. Additionally, I'll assume that $M$ and $H$ don't intersect.
Let $\tilde{M} = \{(x,y,z) \in \mathbb{R}^{3}: \frac{x^2}{a^2}+ \frac{y^2}{b^2}+\frac{z^2}{c^2} \leq 1\}$ and notice that this is convex set. Given a point $p$ the closest point in $X$ to $p$ is the projection of $p$ onto $X$, i.e., $proj_{X}(p)$. Therefore, to find the minimum distance between two sets we need to find two points $v\in M$ and $w\in H$ such that $w = proj_M(v)$ and $v = proj_H(w)$. To find these points we are going to use the fact that the vector $n = p-proj_{X}(p)$ is normal to the set $X$ at $proj_{X}(p)$. Notice that if $w = proj_M(v)$ and $v = proj_H(w)$ then $n_v = v-proj_{X}(v) = v-w$ and $n_w = w-proj_{X}(w) = w-v$ so that $n_v = -n_w$.
The vector $\begin{pmatrix}
\frac{2s}{a^2}x \\
\frac{2s}{b^2}y \\
\frac{2s}{c^2}z \\
\end{pmatrix}
$ where $s\in (0,\infty)$ is normal to $\tilde{M}$ at $(x,y,z)\in M$ and the vector $
\begin{pmatrix}
-t\\
-t\\
-t
\end{pmatrix}
$ where $t\in (0,\infty)$ is normal to $H$ towards $\tilde{M}$ at $(x,y,z)$.
In order for $n_v = -n_w$ we need the normal of $\tilde{M}$ at $(x,y,z)\in M$ to be a positive scalar multiple of $(1,1,1)$. This occurs when $\frac{2}{a^2}x = \frac{2}{b^2}y$ and $\frac{2}{a^2}x = \frac{2}{c^2}z$. Therefore, $y = \frac{b^2}{a^2}x$ and $z = \frac{c^2}{a^2}x$. To determine the point $v$ we see that,
\begin{align}
1 &= \frac{x^2}{a^2}+ \frac{y^2}{b^2}+\frac{z^2}{c^2} \\
&=\frac{x^2}{a^2}+ \frac{b^2}{a^4}x^2+\frac{c^2}{a^4}x^2 \\
&=\frac{a^2+b^2+c^2}{a^4}x^2 \\
x &= \frac{a^{2}}{\sqrt{a^2+b^2+c^2}}
\end{align}
Similarly, you can derive that $y = \frac{b^{2}}{\sqrt{a^2+b^2+c^2}}$ and $z = \frac{c^{2}}{\sqrt{a^2+b^2+c^2}}$. Therefore, the point on $M$ that is closest to $H$ is,
\begin{align}
v =\begin{pmatrix}
\frac{a^{2}}{\sqrt{a^2+b^2+c^2}}\\
\frac{b^{2}}{\sqrt{a^2+b^2+c^2}}\\
\frac{c^{2}}{\sqrt{a^2+b^2+c^2}}
\end{pmatrix}
\end{align}
Next, we want to determine the value of $k$ such that
\begin{align}
w &= v + k\begin{pmatrix}
1\\
1\\
1
\end{pmatrix}
\end{align}
Note that the vector (1,1,1) is the normal vector of $M$ at $v$. The point $w = (w_1,w_2,w_3)$ is in $H$ if $w_1+w_2+w_3 = h$ therefore,
\begin{align}
h &= w_1+w_2+w_3 \\
&= v_1+v_2+v_3 + 3k \\
&= \frac{a^{2}}{\sqrt{a^2+b^2+c^2}} + \frac{b^{2}}{\sqrt{a^2+b^2+c^2}} + \frac{c^{2}}{\sqrt{a^2+b^2+c^2}} + 3k \\
&= \sqrt{a^2+b^2+c^2} + 3k \\
k &= \frac{h-\sqrt{a^2+b^2+c^2}}{3}
\end{align}
Lastly, $Dist(M, H) = || w- v|| = ||k\begin{pmatrix}
1\\
1\\
1
\end{pmatrix}|| = \sqrt{3}k = \frac{h-\sqrt{a^2+b^2+c^2}}{\sqrt{3}}$.
Sorry, if the explanation is not clear. If you have any questions add a comment below.
</s>