I have two points $ A = (3,5)$ and $B = (5,2)$, I want to find their midpoint C = (4, Y).
In this case Y would be 3.5
Is there a formula to find out what the $ Y $ of a point is, in relation to the other two points?
exemple: Given A (3.5) B (5.2) complete: C (4, Y), the answer would be: C (4.3.5); C (3.5, Y), the answer would be: C (3.5,4.25); C (4.5, Y), the answer would be: C (4.5,2.5);
I think what you are trying to do is find the midpoint of the line joining $A$ and $B$. If we generalise and say that \begin{align}A&=(x_A,y_A)\\ B&=(x_B,y_B)\end{align}
then the coordinates of the midpoint of the line joining them together can be written as
$$C=\left(\frac{x_A+x_B}{2},\frac{y_A+y_B}{2}\right)$$
In the example you gave, we have \begin{align}A&=(3,5)\\ B&=(5,2)\end{align}
Therefore \begin{align}C&=\left(\frac{3+5}{2},\frac{5+2}{2}\right)\\ &=\left(\frac82,\frac 72\right)\\ &=(4,3.5)\end{align}
If in fact what you are trying to do is simply find the point on the line joining $A$ and $B$, given an $x$-coordinate, then we need to find the equation of the line.
We need to know the slope of the line which is given by $$m=\frac{y_B-y_A}{x_B-x_A}$$
Now we can use the "point slope formula" to find the equation of the line:
$$y-y_A=m(x-x_A)$$
Therefore, the $y$ coordinate can be found using
\begin{align}y&=m(x-x_a)+y_A\\ &=\frac{y_B-y_A}{x_B-x_A} (x-x_A)+y_A\\ &=\frac{(y_B-y_A)(x-x_A)}{x_B-x_A}+y_A\end{align}
For our example, this is the same as saying
\begin{align}Y&=\frac{(2-5)(x-3)}{5-3}+5\\ &=\frac{-3(x-3)}{2}+5\end{align}
When we have $C=(4,Y)$, then this gives
\begin{align}Y&=\frac{-3(4-3)}{2}+5\\ &=\frac{-3\times 1}{2}+5\\ &=5-\frac 32\\ &=3.5\end{align}
or, for $C=(3.5,Y)$, we would have
\begin{align}Y&=\frac{-3(3.5-3)}{2}+5\\ &=\frac{-3\times0.5}{2}+5\\ &=\frac{-1.5}2+5\\ &=5-0.75\\ &=4.25\end{align}
This is slightly different to the result you are expecting, but I believe your result is wrong and this is what you intended