I am trying to understand what a p value is and what is its importance in statistics, from this example.
For $50$ specimens of alloy steel the rock hardness scale measured an average of $62$ with standard deviation $8$ he manufacturer claims that the alloy has average strength of $64$ at significance of $0.01$ can you refute this?
Well I did this problem and saw no at this level you cant refute it , I use the null being that the hardness was $64$ and the alternate that the hardness was less then $64$. From the data we observe a $z=-1.7677$ but the chart is $z=-2.33$ and so we cant refute null at this level.
But now I want to understand what the p value would be ,
I thought it was that the p-value is the probability of getting the observed value of the test or a value with even more evidence against the null if the null is actually true. So using that I just look on the z chart, the probability of seeing Z greater then $1.7677$ is $0.0384$, so is that the p value?
First off, if you have the sample standard deviation, not the population standard deviation, you should run a $t$-test, not a $z$-test. However, I'll assume you’re assuming that the population standard deviation is also $8$, which in practice is an unwarranted assumption, but it’s okay while you’re learning the material so you don’t have to mess with $t$-tables.
The wording of the question is a bit odd; the manufacturer’s claim is not based on the sample, so a better statement of the question would be this:
A manufacturer claims that a steel alloy it produces has an average hardness of 64. In order to evaluate this claim, you test a random sample of 50 specimens, which have an average hardness of 62 with standard deviation 8. Assuming that the population standard deviation is also 8, does this refute the manufacturer’s claim at a significance level of 0.01?
Unless you have reason to believe that the alloy hardness is specifically less than 64, you should run a two-tailed test. The $p$-value for this test turns out to be 0.0771. This is the area under the distribution of sample means that contains sample means as far or further from 64 than your sample (in either direction).
(Note: for a $t$-test, it turns out to be 0.0833.) For a one-tailed test, it would be 0.0771/2, or just the area corresponding to sample means further from 64 in the direction of your sample mean.
This is what you found (close enough, up to rounding), so the short answer to your question is that you have correctly understood the $p$-value.