Wednesday, 5 December 2012

Problem-solving episode

The problem I decided to look at for this post is the following:

https://wwwcgi.cdf.toronto.edu/~heap/cgi-bin/Solvent/wiki.pl?Problem_Solving_Home_Page/TryThisProblem

Note: I avoided looking at any solutions proposed for this problem, in order to fully show my problem-solving thought process, which I don't want entailing " Looked at a solution which worked and made me realize what I should be doing :P"

Following Polya's approach to how to solve problems (explained in this link), I will be divided this post into 4 parts, each part highlighting a step in my problem solving process and what that entitled for the above particular problem.

Problem:
Suppose n stands for some positive whole number. Define a function f(n) that associates n with another positive whole number, as follows:
If n is even, then f(n) is n/2
If n is odd, then f(n) is 3n+1
Since f(n) takes any positive whole number as input, and produces a positive whole number as output, it makes sense to talk about f(f(n)) or f(f(f(n))) --- composing f with itself several times. Let's define F(m,n) as f(f(...f(n)...), where f is composed with itself m times. Is the following statement true or false?

For each natural number n there exists a natural number m such that F(m,n) = 1.

Note: I avoided choosing a problem that we might've been given in class/in an assignment or in a tutorial. That is because I felt like solving a problem from scratch, and had I done a problem from any of the previously mentioned pools of problems, I would already kind of have an idea of the type of thing I'm supposed to do and where to start, depending on the time that problem was presented and what we were doing in lecture at the time.

STEP 1: Understanding the problem:
Personally, this step entitled defining two piece-wise functions, F(m,n) and F(n), and re-writing  the statement I'm trying to prove in a different way to ensure that I fully understand the statement.

Piece-wise functions:
F(n) = {n/2            if n is even
             { 3n+1       if n is odd

F(m,n) = {F(n)                       m=0
                  {F(m-1, F(n))       m > 0

Statement
for any natural number, if we compose f(n) of itself enough times (m times), we get 1 out of applying F(m,n).

STEP 2: Devising a plan:
For this part of my problem-solving process, I found myself thinking of different approaches to solving the given problem. Thoughts included complete induction and mathematical induction. In order to decide which flavour of induction to use, I decided to set my definitions hoping that would give me a hint as to the type of induction I should use.

Definitions:
The definitions of the functions were given above.
(Side note: since n is said to be a positive number, my predicate will be dealing with a positive n, not any natural number (i.e. not zero))
Let P(n) be the predicate such that:
P(n) : For all positive natural numbers n, there exists a natural number m such that F(m,n) = 1.

While writing the above definition out, I could partially see how to approach the problem through complete induction, so i decided to follow through and see if complete induction works.
I would have to have a base case of n=1. Propose m=0 and show P(n).
For the induction step, I would assume P(i) for all natural numbers greater than 0 and less than n (0<i<n), and look at 2 cases; 1. If n is an even number, then I would use the induction hypothesis to state that there's a natural number m, such that P(n/2) holds and show that by adding 1 to the previous m, we get P(n)
and here is where the problem arises 2. If n is an odd number, then F(m,n) = F(m-1,3n+1), since 3n+1 is greater than n, I can't use the induction hypothesis in any way.
I then tried looking at what P(n) would look like,F(m,n) =  F(m-1,3n+1) = F(m-1, 3(2k+1) + 1) for some natural number k (since n is odd) = F(m-1, 2(3k+1))
= F(m-2, 3k+1) = F(m-2, n+k). since n+k is still bigger than n, I can't use the induction hypothesis anywhere here either. I then tried dividing case 2 into 2 more cases, if k is even (n+k odd) and if k is odd (n+k even), but that only seemed to make the problem bigger.
I then went on to think of how the problem would look like had I used mathematical induction, but that approach didn't get me much further.
After the extensive amount of proof trials, I re-read the problem and thought, maybe the statement is false, and a counterexample is what I need.
I then looked at the number 9 and saw a contradiction.

STEP 3: Carry out plan:
Let n = 9. Assume m is a natural finite number.
Then F(m,9) = F(m-1, F(9))
                         = F(m-1, 3(9)+1)
                         = F(m-1, 28)
                         = F(m-2, 14)
                         = F(m-3, 7)
                          = F(m-4, 22)
                          = F(m-5, 11)
                           = F(m-6, 34)
                           = F(m-7,18)
                          = F(m-8, 9)
# contradiction, since there's a loop when setting n to be 9, m would be an infinite number. Therefore there won't be an m such that F(m, 9) = 1. Therefore the statement is false.

STEP 4: Look back:
From solving this particular problem, I learned to read questions more carefully. If the question isn't asking me to see if the statement's true or false before proving it, I should definitely start by trying many examples and trying to find a counterexample, before attempting to prove the statement.

In addition, through trying to solve the problem, I realized that the statement would be true if n was a power of 2, since that way, we would never need to look at n being odd, therefore never have to use F(n) = 3n+1

ENTERTAINMENT:
I know this section only showed up once or a couple of times before, but here it is again :)

This is something I thought was super cool in google:
if you search recursion in google, you'll see one of google's coolest hidden easter eggs. Look at it! It might take a couple of seconds to notice what it is, it sure did for me. Ok fine I'll tell you. Typing recursion in google gets you to a page that says "Did you mean recursion" which if pressed over and over again takes you to an infinite recursive loop! :D

For 17 other cool google easter eggs, check out this website:
http://www.searchenginepeople.com/blog/ongoing-list-google-search-easter-eggs.html

Tuesday, 4 December 2012

Exam-Studying attack plan!

This is a post I hope will be shorter than the previous one. The following are a list of what my plan is for studying for this exam, my "tips", if you will, for how to go about attacking all the materials and making sure everything's well understood.

* Look at the empty lecture notes for each week, starting at the first one and going from there, solve each question given as an example in the lecture notes. After finishing each week's lecture notes, look at the annotated notes and the course notes that correspond to check your solution. If the solution was wrong, attempt it later on after finishing a couple of other weeks' materials/taking some rest.

* After finishing all the lecture notes given. Look at empty tutorial slides, do the same thing in solving the problems, on paper, then checking them against the solution.

*Look at the tests briefly afterwards, see where you might've gone wrong! Compare solutions to corresponding course notes to see the right way of answering each one of the questions you answered wrong. Also, briefly look at the questions you answered right just to make sure you still fully understand them.

* Do the same thing done with tutorial handouts, but with assignments this time. Compare the solution you get from answering the question now, to the one in the assignment solution, to the one in your own solution. Look carefully at the differences, to get an idea of possibly different ways of handling questions.

**Get a good night sleep the night before the exam :D

Hope this helps anybody unsure of where to start :D

Good luck :)

An overall review of the experience :)

Well hey there slog, it's been a while....

Starting off this course, I thought keeping a diary-like blog of my experience in the course and how I handled difficulties would be an easy part of it. I still think it would've been, but there's something about an on-going assignment that's due at the very end of the course that gets you, or me at least, to put it at the back of my head, and maybe sometime, when busy with all the other assignments and tests, even get to the point of forgetting about it, which is too bad considering how cool and exciting I thought this assignment is. In any way, I'm here now and nothing's preventing me from going over the entire course's experience and what I did throughout to keep up with the material right now. So here it goes.

The following will be divided into an overall review of the course, and then a more detailed review of each and every evaluating method, including the difficulties I might've had and how they were handled, in addition to the preparation that happened before the particular quiz/test/assignment-typing.

THE COURSE was definitely a great learning experience. The materials were presented clearly in a very logical progression throughout and a big component of the lecture-time was dedicated to discussions and answering any questions anybody had, no matter how small or trivial they were, in great detail which was absolutely amazing.  In addition, the evaluation methods were well-spaced out. I really liked how we had a chance to review material every week in tutorial, with a relatively simple quiz at the end to make sure we understood the tutorial, and to encourage us to pay full attention in tutorials. The assignments were just as well-paced and they took what we learn an extra step to challenge us. Tests then became the sweet middle.

THE QUIZZES were the evaluation methods I rarely got over 50% on, mostly cause they're marked on the scale of either 0/2, 1/2 or the perfect 2/2. Most marks lost for me personally weren't due to lack of knowledge as much as missing small details here and there. They were a good way of knowing where I might be giving too little information or making a logical mistake in proving a certain thing. I'd usually prepare for quizzes on my way to them or the night before. I looked at the questions and tried answering them, then went on to see the TA's answer and compare mine to that of the TAs to see the differences. It was a great way of staying on track.

THE TESTS weren't difficult at all compared to what we've seen in class. Unfortunately though, test 2 was at a bad time for me since I had countless other assignments/tests and things I had to take care off quickly at the time. Therefore my answers didn't reflect my understanding of the material due to the amount of stress I was under. Even though that was the case, after getting my test back, I made sure that I understood exactly where I went wrong in my thought process/problem solving technique to avoid it in the future, which I think was what was important to move on and do better afterwards.

THE ASSIGNMENTS were at just the right difficulty, in my opinion, for us to be able to solve them not immediately but after a bit of thought and a bit of staring at the assignment trying to figure out exactly what each question is asking. My process for attacking assignments went as follows. Read the questions and attempt them. Look at the course notes, the annotated lecture notes and tutorial solutions for similar concepts and how they were approached. Sleep. Look at the problems again. Have an idea of how the solution's going to be like. Go to Prof. Heap's office hours to see what people are struggling with and confirm my idea of the right solution. Type up the solutions. The only problem I was facing was that I'd know what the solution would be like very well, but I'd actually write it down on paper/type it later than the ideal time to. This usually caused my solutions to have less details in them than I would like. To try and avoid that problem, I tried writing, in great detail, the solutions I had in my mind on paper to try and express everything I mean to and leave the typing up the formal solution to the problems till near the end. I feel that this approach improved my final solution to the assignments a lot.

If you're reading this, it means that you've either skipped over the LONG post, which I don't blame you for, it's long!! Or you've read through the entire post, which I really appreciate and thank you for taking the time. :)

PS. If you want a great writing a blog entry experience, the UC quad on a day with great weather, like today, is a fantastic choice! :D
PPS. sorry for the super long post and I hope the caps give the readers an idea of what each paragraph is talking about in order to maybe choose what to read about.