Let us say we have n boxes, and one car.
The probability that one of them might have a car = p
and each box is equally likely to have a car, therefore the change that a single box has car = p/n
Now let us consider the chance that box 1 has car, given other boxes don't have car
P(Box 1 contains car | other n-1 boxes don't contain car)
$$=\frac{P(Box\space1\space contains\space car \cap other\space n-1\space boxes\space don't\space contain\space car)}{P(other\space n-1\space boxes\space don't\space contain\space car)}$$
$$=\frac{P(Box\space1\space contains\space car)}{P(other\space n-1\space boxes\space don't\space contain\space car)}$$
$$=\frac{\frac{p}{n}}{ \left( 1 - \frac{p}{n} \right)^{(n-1)} }$$ [1]
But if we apply this result to classical monty hall problem where we have 3 boxes. Let us say contestant chose box 1.
Other two boxes have p = 2/3 to have car, n = 2,
each box will have probability of p/n = $\frac{2/3}{2} = 1/3$, of having a car
If monty opens up say box 3(which doesn't have car),
the probability of box 2 having car
$$=\frac{\frac{p}{n}}{ \left( 1 - \frac{p}{n} \right)^{(n-1)} }$$
here p = 2/3
n = 2 $$=\frac{\frac{2/3}{2}}{ \left( 1 - \frac{2/3}{2} \right)^{(2-1)} }$$ $$= 1/2$$
which is not the correct answer. I have done something wrong and [1] is not valid result.
What is wrong with it?
PS: I know how to solve monty hall problem using other approach. I want to know what is wrong with this approach?
First off, your are not actually computing the Monty Hall Problem. You are computing the probability: $$ P(\text{box 2}\mid\text{not box 3})=\frac12 $$ Whereas the Monty Hall Problem is concerned with the probability: $$ P(\text{box 2 OR box 3}\mid\text{(not box 3) OR (not box 2)})=\frac23 $$
To comment on your derivation, by $n$ you do not mean the total number of boxes since otherwise specifying that $n-1$ boxes do not contain a car would be redundant. This was unclear when I read it at first.
Instead suppose we have $N>n$ boxes in total. Then you are asking:
To be clear, this entails the possibility that the car may in fact be in one of the remaining $N-n$ boxes.
Then most of your derivation is correct, except for your denominator. It considers the $(n-1)$ boxes as $(n-1)$ independent trials, which it is not. We are only considering a single trial here. Rather the denominator should be: $$ P(\text{not the other $n-1$ boxes})=1-(n-1)\cdot\tfrac pn $$