I took a stab at deriving the time dilation formula for velocity. This is entirely my own approach though I suspect it is nothing new/special in terms of how it is derived. Just wanted to have some fun and see if i could figure it out for myself. So I knew it was all based on the idea that the speed of light is a constant in any frame of reference. So I drew this diagram showing two frames of reference.
So what I did was I tried to calculate the amount of time it would take for light to travel between the two people in the spaceship (A and B). The distance between them is $D_x$. That's the distance light travels in the rest frame. Then I calculated the distance it would travel as an outside observer would see it (accounting for the velocity of the space ship). For that the distance was longer, but the speed of light the same. The ratio between the difference between the apparent time from the two observers would be the time dilation. Here is my math.
$$ T_0 = \frac{D_x}{C} $$
$$ D_y = V_y \cdot T_0 $$
$$ D_y = V_y \cdot \frac{D_x}{C} $$
$$ D_1 = \sqrt{{D_{x}}^2 + {D_{y}}^2} $$
$$ D_1 = \sqrt{{D_{x}}^2 + {(V_y \cdot \frac{D_x}{C})}^2} $$
$$ T_1 = \frac{D_1}{C} $$
$$ T_1 = \frac{\sqrt{{D_{x}}^2 + {(V_y \cdot \frac{D_x}{C})}^2}}{C} $$
$$ T_1 = \frac{\sqrt{{D_{x}}^2 + {V_y}^2 \cdot \frac{{D_x}^2}{C^2} }}{C} $$
$$ T_1 = \frac{\sqrt{{D_{x}}^2 + {V_y}^2 \cdot \frac{1}{C^2} \cdot {D_x}^2 }}{C} $$
$$ T_1 = \frac{D_x \cdot \sqrt{1 + {V_y}^2 \cdot \frac{1}{C^2} }}{C} $$
$$ T_1 = \frac{D_x \cdot \sqrt{1 + \frac{{V_y}^2}{C^2} }}{C} $$
$$ \Delta T = \frac{T_0}{T_1} $$
$$ \Delta T = \frac{\frac{D_x}{C}}{\frac{D_x \cdot \sqrt{1 + \frac{{V_y}^2}{C^2} }}{C}} $$
$$ \Delta T = \frac{D_x}{C} \cdot \frac{C}{D_x \cdot \sqrt{1 + \frac{{V_y}^2}{C^2} }} $$
$$ \Delta T = \frac{C D_x}{C D_x \cdot \sqrt{1 + \frac{{V_y}^2}{C^2} }} $$
$$ \Delta T = \frac{1}{\sqrt{1 + \frac{{V_y}^2}{C^2} }} $$
So just some notes, subscript 0 here, such as $T_0$ refers to the time in the rest frame, and subscript 1 here, such as $T_1$ represents the frame of reference where the ship is moving.
As you can see the final equation I get is almost exactly right but i seem to have resulted in a plus sign where there should be a minus sign. After going through my work I can't find the source of my error. What did I do wrong?