Saturday, April 23, 2011

TJ Maxx and Maximizing Fashion

"I never wear the same thing twice, not together anyway."
-TJ Maxx
I don't know anything about fashion. Whenever I need to buy clothes, I ask a friend to go shopping with me and have them pick out whatever I need. Nonetheless, I'm going to write about maximizing fashion.

This post is inspired by a TJ Maxx commercial I'm seeing a lot of lately [full transcript at footnote 1]. The narrator (identified as Lindsay Fashion Designer) starts off by announcing that she never wears the same thing twice. If she doesn't have a good grasp of combinatorics then that could be very expensive.

Obviously, the worst possible strategy for not wearing the same thing twice is buying 365 outfits a year. (Yes, I'm assuming she only wears one outfit a day.)  Since she can mix and match her clothes, she can get more bang for her buck. For example, if she had 5 pairs of pants, and 73 shirts, then she would actually have 5x73 or 365 different outfits. This is much cheaper because she would only have to buy 78 items of clothing (5+73), and not 365.

She can actually do much better than this. If she has 5 pairs of pants, 5 shirts, 5 scarves and 3 hats (only 18 items of clothes), she can has 5x5x5x3 or 375 different outfits (that's one for every day of the year, plus 10 left over). Don't trust my math? Here's a picture:
[footnote 2 for the Proccesing script I wrote to generate this]
18 clothing items for one year is pretty good. I can do better. With 2 shirts, 2 pairs of shoes, 2 pairs of pants, 2 hats, 2 sunglasses, 2 vests, 2 pairs of socks and 3 belts, you can get 384 days (that a year plus 19 bonus outfits) out of just 17 clothing items. Better yet is 3 hats, 3 pairs of shoes, 3 scarves, 3 pairs of pants and 5 shirts for a total 405 days of fashion.


405 was the best I could do in my head, but I wrote a Python script to try it out, and it came up with 2 pairs of shoes, 3 shirts, 3 pairs of pants, 3 hats, 3 scarves and 3 belts for a total of 486 days on only 17 items clothing. [footnote 3 for that script]

If you want to know how to make n outfits out of least number of clothing items,  factor n completley:



and your total number of clothing items is m:



What's the strategy for for finding the optimal number? I'm not sure. Is 17 the least number of clothing items needed to go a whole year without repeat outfits? I think so, but I can't prove it. Yes:

We already know that 17 is a candidate for the least number of clothing items. That means any n will have to be in the form:



If our optimal number has a 7 in its prime factorization, we would be wise to replace it with an 8, because that would give us more fashion for lest cost (the cost of 8 is 6 because 8 is 2x2x2 and that means having 6 (2+2+2) items of clothing). The same is true for any number larger than 7; it can always be replaced with a cheaper number [footnote 4 for my proof of this].

Therefore we can assume that our number of outfits, n, is in the form:



That means only testing 120 possibilities (8x5x3, because the most a can be is 8, the most b can be is 5 and the most c can be is 3). This is easily checked by computer (I wrote a Python script, it could have just as easily been done in Excel).

So the absolute cheapest way to wear a different outfit every day of the year is to have 17 different articals of clothing,

-Nick

[1] "I never wear the same thing twice, not together anyway. I'm in TJ Maxx... every week. I used to think it was old school, but it's not. I get this season's designer clothes (that I absolutely need), and I still get to eat. Fashion direct from designers, savings direct to you. That's right, I'm a Maxxinista." The best quality video I can find is here, starting at 0:55.

[2] After drawing the different clothing items by hand, I edited and colored them with Gimp. Then I wrote this script in Processing:
int w = 27; //number of maxxinistas horizantally
int h = 14; //number of maxxinistas vertically
size(w*40,h*80);


//Grab all the drawings and store them in the approrite arrays
PImage stick = loadImage("stick.png");
PImage shirt[] = {loadImage("redshirt.png"),
                           loadImage("blueshirt.png"),
                           loadImage("greenshirt.png"),
                           loadImage("orangeshirt.png"),
                           loadImage("purpleshirt.png")};
PImage pants[] = {loadImage("redpants.png"),
                           loadImage("bluepants.png"),
                           loadImage("greenpants.png"),
                           loadImage("orangepants.png"),
                           loadImage("purplepants.png")};
 
PImage scarf[] = {loadImage("redscarf.png"),
                           loadImage("bluescarf.png"),
                           loadImage("greenscarf.png"),
                           loadImage("orangescarf.png"),
                           loadImage("purplescarf.png")};
 
PImage hat[] = {loadImage("bluehat.png"),
                           loadImage("greenhat.png"),
                           loadImage("catinthehat.png")};
 
PImage shoes[] = {loadImage("greyshoes.png"),
                           loadImage("iceshoes.png"),
                           loadImage("elfshoes.png")};
 
background(200);


//How many of each clothing item?
int pan = 5; // max 5
int shi = 5; // max 5
int sho = 1; // max 3
int sca = 5; // max 5
int haa = 3; // max 3


for(int i=0; i < pan*shi*sho*sca*haa; i++){
     image(stick, 40*(i%w), 80*(i/w) , 40, 80);
     image(shirt[(i/pan)%shi], 40*(i%w), 80*(i/w)+30, 40, 20);
     image(pants[i%pan], 40*(i%w), 80*(i/w)+50, 40, 20);
     image(scarf[(i/(pan*shi))%sca], 40*(i%w), 80*(i/w)+25, 40, 5);
     image(hat[(i/(pan*shi*sca))%haa], 40*(i%w), 80*(i/w)+0 , 40, 25);
     image(shoes[(i/(pan*shi*sca*haa))%sho], 40*(i%w), 80*(i/w)+70, 40, 10);
}


//hook me up with a picture
saveFrame("fashion.png");
[3] Python script for counting the optimal number of clothes to own to last at least 365 days without a repeat outfit:
def best(m):
    b = 365
    for i in range(365,m):
        if sum(factor(i)) <= b:
            print(i,sum(factor(i)))
            b = sum(factor(i))
    return b

m is the maximum number outfits you want. This function calls factor(), another short script I wrote:

def best(n,m):
    b = 365
    for i in range(n,m):
        if sum(factor(i)) <= b:
            print(i,sum(factor(i)))
            b = sum(factor(i))
    return b


[4] Prove that if n is a prime larger than 5, then the cost of n+1 is less than the cost of n (the cost of a number is the sum of its prime factors, with repeats): If n is prime and more than 5, then n+1 is even and can be written as . The cost of n is n, and the cost of n+1 is at most 2+(n+1)/2. Since 2+(n+1)/2 < n for all n>5, n costs less than n+1.

No comments:

Post a Comment