Confusion regarding path difference by glass slab in YDSE If in a YDSE experiment the setup is immersed in a medium $n_{med}$, and a glass slab of thickness t of another medium $n_{glass}$ is introduced in front of one slit, then is the path difference due to introduction of the glass slab 
$(\frac{n_{glass}}{n_{med}}-1)t$ 
or 
$(n_{glass}-n_{med})t$ 
Attempt at solution: Since the optical path in the region of the glass slab, 'with the slab' is $(\frac{n_{glass}}{n_{med}})t$ and 'without the slab' is just t ; the path difference due to introduction of the glass slab should be
$(\frac{n_{glass}}{n_{med}}-1)t$ 
But
In a similar problem (given below) the path difference due to the slab alone according to my text is $(n_{3}-n_{2})t$ 

Why is this so? since both equations give different answers, What is the correct one?
NB: i know that similar questions have been asked but none have a proper complete answer hence i am asking this  
 A: I will assume that all the refractive indices that you have quoted in your question are relative to a vacuum.
The ideas of optical path and optical path difference is really all to do with counting wavelengths.
Within a thickness of glass $t_{\text{glass}}$, assume there are $N$ waves each of wavelength $\lambda_{\text{glass}}$. Therefore, we have $t_{\text{glass}} = N\lambda_{\text{glass}}$.
The thickness of medium $t_{\text{medium}}$ which has the same number of waves $N$, each of wavelength $\lambda_{\text{medium}}$, as before is $t_{\text{medium}} = N\lambda_{\text{medium}}$
The difference in thickness containing the same number of waves is $t_{\text{medium}}- t_{\text{glass}} =  N\lambda_{\text{glass}} - N\lambda_{\text{glass}}$. Therefore,
$$f \lambda_{\text{medium}} = c_{\text{medium}} = \frac {c_{\text{vacuum}}}{n_{\text{medium}}} \\ f \lambda_{\text{glass}} = c_{\text{glass}} = \frac {c_{\text{vacuum}}}{n_{\text{glass}}}$$
where $f$ is the frequency, $c$ is the wave speed and $n$ is the refractive index. Thus, $\lambda_{\text{glass}} n_{\text{glass}} = \lambda_{\text{medium}} n_{\text{medium}}$.
Substituting into the equation for difference in thickness gives $$t_{\text{medium}}- t_{\text{glass}}= \left(\frac{n_{\text{glass}}}{n_{\text{medium}}}-1 \right)t_{\text{glass}}$$
So the number of extra waves introduced by the insertion of the glass is $$\frac{t_{\text{medium}}- t_{\text{glass}} }{\lambda_{\text{medium}}}=\left (\frac{n_{\text{glass}}}{n_{\text{medium}}}-1 \right)\frac{t_{\text{glass}}}{\lambda_{\text{medium}}}$$
Had the number of extra waves been $1/2$, then the fringe pattern would have moved by half a fringe and where there had been a maximum there would be a minimum etc.
If you substitute $\lambda_{\text{medium}} = \dfrac{\lambda_{\text{vacuum}}}{n_{\text{medium}}}$ into the equation, the number of extra waves is $$\frac{(n_{\text{glass}} - n_{\text{medium}})t_{\text{glass}}}{\lambda_{\text{vacuum}}}$$
The term $(n_{\text{glass}} - n_{\text{medium}})t_{\text{glass}}$ is called the optical path difference and relates to the wavelength in a vacuum.
A thickness of glass $t_{\text{glass}}$ has the same number of waves as a thickness of vacuum equal to $n_{\text{glass}} t_{\text{glass}}$ and this is called the optical path length.

So in summary:
$$\left(\frac{n_{\text{glass}}}{n_{\text{medium}}}-1\right)t_{\text{glass}}$$ relates to the wavelength in the medium, and
$$(n_{\text{glass}}-n_{\text{medium}})\,t_{\text{glass}}$$
relates to the wavelength in a vacuum.
