# Calculate dimensions of inner box

This is my first post here and also i'm bad with math so don't be mad at me :)

Here is my issue, i have a box and i have another box inside, now i want that box inside to be at exactly same distance from each side, no matter what size it parent is.

Now i know how to calculate the distance from the sides, but i can't figure how to get right box dimensions. To make thing more clear i draw this example:

http://www.part.lt/img/f2204b0558a21a3695c6698de6e0f7f4835.png

I hope i make some sense here :)

-
Do you want to maximize the volume of the box inside such that the distance from either side between the boxes is same? This is a optimization problem and we can use tools from calculus to solve it. Maximize $A=(x-2d)(y-2d)$ where $A$ is area of box inside and $x,y$ are length and width respectively. Although, I am not sure where this will lead to! –  Lyapunov Jul 1 '12 at 23:37

If your outer box is $x \times y$ and you want the inner one at distance $d$, the inner dimensions are $x-2d \times y-2d$ and the centers need to match. Is that what you are after?